From 65aa3f744610a38bf4f2bf160b6df8f80edbee64 Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Wed, 21 Oct 2026 13:25:26 +0300 Subject: [PATCH] scst: Remove redundant values and simplify known conditions Remove overwritten initial values, unused offsets and zero-bit flag operands. Derive the saved sense length from its captured value and rely on C zero initialization for static-duration userspace objects. The FC copy path remains unconditional because its buffers outlive the request. Select CRC availability with the same four CONFIG predicates and use else for a negative SRP residual only inside the nonzero-residual branch. Group ternary bit tests and trim the PR filename's newline with strchr(), retaining the empty-filename fallback. Manual review also identified the overwritten QLogic tag initializer; every allocator branch assigns it. Cppcheck reports: redundantAssignment: Variable 'tp' is reassigned a value before the old one has been used. unreadVariable: Variable 'sg_cnt' is assigned a value that is never used. unreadVariable: Variable 'data_offset' is assigned a value that is never used. clarifyCalculation: Clarify calculation precedence for '&' and '?'. ignoredReturnValue: Return value of function strsep() is not used. knownConditionTrueFalse: Condition '!crc32c' is always false. knownConditionTrueFalse: Condition 'resid<0' is always true. badBitmaskCheck: Operator '|' with one operand equal to zero is redundant. It also marks the initial rc value in dev_user_process_cleanup() unread. Checkpatch reports GLOBAL_INITIALISERS: do not initialise globals to false --- fcst/ft_io.c | 2 -- iscsi-scst/kernel/digest.c | 12 ++++------ iscsi-scst/kernel/isert-scst/iser_pdu.c | 1 - iscsi-scst/kernel/isert-scst/iser_rdma.c | 2 -- iscsi-scst/usr/log.c | 2 +- qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c | 2 +- scst/src/dev_handlers/scst_user_main.c | 2 +- scst/src/dev_handlers/scst_vdisk_main.c | 22 +++++++++---------- scst/src/scst_copy_mgr.c | 7 +++--- scst/src/scst_event.c | 3 +-- scst/src/scst_lib.c | 7 +++--- scst/src/scst_local_cmd.c | 12 +++++----- scst/src/scst_pres.c | 4 ++-- scst/src/scst_sysfs.c | 5 +++-- scst/src/scst_targ.c | 2 +- scst_local/scst_local.c | 2 +- srpt/src/ib_srpt.c | 6 ++--- usr/events/events.c | 2 +- usr/fileio/fileio.c | 2 +- 19 files changed, 43 insertions(+), 54 deletions(-) diff --git a/fcst/ft_io.c b/fcst/ft_io.c index b8ec2f9bb..1dc22063f 100644 --- a/fcst/ft_io.c +++ b/fcst/ft_io.c @@ -107,8 +107,6 @@ int ft_send_read_data(struct scst_cmd *cmd) #endif } - /* no scatter/gather in skb for odd word length due to fc_seq_send() */ - use_sg = !(remaining % 4) && lport->sg_supp; /* * Note: since libfc_function_template.seq_send() sends frames * asynchronously and since the SCST data buffer is freed as soon as diff --git a/iscsi-scst/kernel/digest.c b/iscsi-scst/kernel/digest.c index 577605194..b02762b44 100644 --- a/iscsi-scst/kernel/digest.c +++ b/iscsi-scst/kernel/digest.c @@ -26,17 +26,13 @@ void digest_alg_available(int *val) { -#if defined(CONFIG_LIBCRC32C_MODULE) || defined(CONFIG_LIBCRC32C) || \ - defined(CONFIG_CRC32_MODULE) || defined(CONFIG_CRC32) - int crc32c = 1; -#else - int crc32c = 0; -#endif - - if ((*val & DIGEST_CRC32C) && !crc32c) { +#if !defined(CONFIG_LIBCRC32C_MODULE) && !defined(CONFIG_LIBCRC32C) && \ + !defined(CONFIG_CRC32_MODULE) && !defined(CONFIG_CRC32) + if (*val & DIGEST_CRC32C) { PRINT_ERROR("CRC32C digest algorithm not available in kernel"); *val &= ~DIGEST_CRC32C; } +#endif } /** diff --git a/iscsi-scst/kernel/isert-scst/iser_pdu.c b/iscsi-scst/kernel/isert-scst/iser_pdu.c index c5cda7212..39b0ec498 100644 --- a/iscsi-scst/kernel/isert-scst/iser_pdu.c +++ b/iscsi-scst/kernel/isert-scst/iser_pdu.c @@ -268,7 +268,6 @@ int isert_prepare_rdma(struct isert_cmnd *isert_pdu, } buff_offset = 0; - sg_cnt = 0; for (wr_cnt = 0, sg_offset = 0; sg_offset < isert_buf->sg_cnt; ++wr_cnt) { sg_cnt = min((int)isert_conn->max_sge, diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index 44e29848c..9579000a0 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -286,7 +286,6 @@ static void isert_rx_pdu_parse_headers(struct isert_cmnd *isert_pdu) u8 *addr = isert_buf->addr; struct isert_hdr *isert_hdr = (struct isert_hdr *)addr; struct iscsi_hdr *bhs = (struct iscsi_hdr *)(addr + sizeof(*isert_hdr)); - unsigned int data_offset = ISER_HDRS_SZ; unsigned int ahssize; TRACE_ENTRY(); @@ -317,7 +316,6 @@ static void isert_rx_pdu_parse_headers(struct isert_cmnd *isert_pdu) isert_pdu->ahs = NULL; } else { isert_pdu->ahs = addr + ISER_HDRS_SZ; - data_offset += ahssize; } iscsi_cmnd->pdu.ahs = isert_pdu->ahs; diff --git a/iscsi-scst/usr/log.c b/iscsi-scst/usr/log.c index a172c21cb..5112bf5df 100644 --- a/iscsi-scst/usr/log.c +++ b/iscsi-scst/usr/log.c @@ -24,7 +24,7 @@ #include "iscsid.h" int log_daemon = 1; -int log_level = 0; +int log_level; void log_init(void) { diff --git a/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c b/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c index 4c6875fe4..effa70c71 100644 --- a/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c +++ b/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c @@ -486,7 +486,7 @@ static struct qla_tgt_cmd *sqa_qla2xxx_get_cmd(struct fc_port *sess) struct sqa_scst_tgt *sqa_tgt = (struct sqa_scst_tgt *)sess->vha->vha_tgt.target_lport_ptr; struct qla_tgt_cmd *cmd; - int tag = -ENOENT; + int tag; #if QLT_USE_PERCPU_IDA tag = percpu_ida_alloc(&sqa_tgt->tgt_tag_pool, TASK_RUNNING); diff --git a/scst/src/dev_handlers/scst_user_main.c b/scst/src/dev_handlers/scst_user_main.c index 970d6ceae..613b31703 100644 --- a/scst/src/dev_handlers/scst_user_main.c +++ b/scst/src/dev_handlers/scst_user_main.c @@ -3834,7 +3834,7 @@ SCST_KUNIT_VISIBLE int dev_user_process_cleanup(struct scst_user_dev *dev) { struct scst_user_cmd *ucmd; - int rc = 0, res = 1; + int rc, res = 1; TRACE_ENTRY(); diff --git a/scst/src/dev_handlers/scst_vdisk_main.c b/scst/src/dev_handlers/scst_vdisk_main.c index 30b16bb27..8ffb2e9ea 100644 --- a/scst/src/dev_handlers/scst_vdisk_main.c +++ b/scst/src/dev_handlers/scst_vdisk_main.c @@ -1869,7 +1869,7 @@ static enum compl_status_e vdisk_exec_format_unit(struct vdisk_cmd_params *p) break; default: scst_set_invalid_field_in_parm_list(cmd, 0, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out; } break; @@ -1877,7 +1877,7 @@ static enum compl_status_e vdisk_exec_format_unit(struct vdisk_cmd_params *p) switch (prot_usage) { default: scst_set_invalid_field_in_parm_list(cmd, 0, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out; } break; @@ -1888,7 +1888,7 @@ static enum compl_status_e vdisk_exec_format_unit(struct vdisk_cmd_params *p) break; default: scst_set_invalid_field_in_parm_list(cmd, 0, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out; } break; @@ -1902,7 +1902,7 @@ static enum compl_status_e vdisk_exec_format_unit(struct vdisk_cmd_params *p) break; default: scst_set_invalid_field_in_parm_list(cmd, 0, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out; } break; @@ -3495,7 +3495,7 @@ static enum compl_status_e vdisk_exec_unmap(struct vdisk_cmd_params *p) if (unlikely(cmd->cdb[1] & 1)) { TRACE_DBG("ANCHOR not supported"); - scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out; } @@ -4402,7 +4402,7 @@ out: out_not_sup: TRACE(TRACE_MINOR, "MODE SENSE: Unsupported page %x", pcode); - scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out_put; } @@ -4598,7 +4598,7 @@ static void vdisk_caching_m_pg_select(unsigned char *p, struct scst_vdisk_dev *v if (save && (!vdev_saved_mode_pages_enabled || virt_dev->nv_cache)) { TRACE(TRACE_MINOR | TRACE_SCSI, "MODE SELECT: saved cache page not supported"); - scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out; } @@ -4710,7 +4710,7 @@ static enum compl_status_e vdisk_exec_mode_select(struct vdisk_cmd_params *p) TRACE(TRACE_MINOR, "MODE SELECT: Invalid request %x", address[offset] & 0x3f); scst_set_invalid_field_in_parm_list(cmd, offset, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out_put; } offset += address[offset + 1]; @@ -4731,7 +4731,7 @@ static enum compl_status_e vdisk_exec_log(struct vdisk_cmd_params *p) TRACE_ENTRY(); /* No log pages are supported */ - scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID); TRACE_EXIT(); return CMD_SUCCEEDED; @@ -4882,7 +4882,7 @@ out: static enum compl_status_e vdisk_exec_get_lba_status(struct vdisk_cmd_params *p) { /* Changing it don't forget to add it to vdisk_opcode_descriptors! */ - scst_set_invalid_field_in_cdb(p->cmd, 1, 0 | SCST_INVAL_FIELD_BIT_OFFS_VALID); + scst_set_invalid_field_in_cdb(p->cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID); return CMD_SUCCEEDED; } @@ -4896,7 +4896,7 @@ enum compl_status_e vdisk_exec_sai_16(struct vdisk_cmd_params *p) case SAI_GET_LBA_STATUS: return vdisk_exec_get_lba_status(p); } - scst_set_invalid_field_in_cdb(p->cmd, 1, 0 | SCST_INVAL_FIELD_BIT_OFFS_VALID); + scst_set_invalid_field_in_cdb(p->cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID); return CMD_SUCCEEDED; } diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index 830f6a615..a656e81ae 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -582,7 +582,7 @@ static void scst_cm_prepare_final_sense(struct scst_cmd *ec_cmd) int d_sense = scst_get_cmd_dev_d_sense(ec_cmd); bool copy_sense = false; int sense_to_copy = ec_cmd->sense_valid_len; - int sense_len = ec_cmd->sense_valid_len; + int sense_len = sense_to_copy; TRACE_ENTRY(); @@ -2228,7 +2228,7 @@ enum scst_exec_res scst_cm_rcv_copy_res_exec(struct scst_cmd *cmd) default: TRACE(TRACE_MINOR, "%s: action %d not supported", cmd->op_name, action); - scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID); break; } @@ -2970,7 +2970,7 @@ static int scst_cm_parse_id_tgt_descr(struct scst_cmd *cmd, const uint8_t *seg, PRINT_WARNING("PERIPHERAL DEVICE TYPE %d not supported", seg[1] & 0xF); scst_set_invalid_field_in_parm_list(cmd, offs + 1, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out_err; } @@ -3203,7 +3203,6 @@ skip_fcmd_create: sBUG(); break; } - tp = t; } tp = t; } diff --git a/scst/src/scst_event.c b/scst/src/scst_event.c index 7c1864140..119a62b06 100644 --- a/scst/src/scst_event.c +++ b/scst/src/scst_event.c @@ -1113,8 +1113,7 @@ int scst_event_init(void) TRACE_ENTRY(); - scst_event_wq = alloc_workqueue("scst_event_wq", 0 - | WQ_UNBOUND, + scst_event_wq = alloc_workqueue("scst_event_wq", WQ_UNBOUND, 0); if (unlikely(!scst_event_wq)) { PRINT_ERROR("Failed to allocate scst_event_wq"); diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 734ebf697..108b21143 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -7428,7 +7428,7 @@ struct scst_session *scst_alloc_session(struct scst_tgt *tgt, gfp_t gfp_mask, * To do: remove higher order allocation from the code below * for the GFP_ATOMIC case. */ - sess->lat_stats = gfp_mask & GFP_ATOMIC ? + sess->lat_stats = (gfp_mask & GFP_ATOMIC) ? kzalloc_obj(*sess->lat_stats, gfp_mask) : vzalloc(sizeof(*sess->lat_stats)); if (!sess->lat_stats) @@ -12118,7 +12118,7 @@ static int get_cdb_info_ext_copy(struct scst_cmd *cmd, PRINT_WARNING("Not supported %s service action 0x%x", scst_get_opcode_name(cmd), cmd->cdb[1]); scst_set_invalid_field_in_cdb(cmd, 1, - 0 | SCST_INVAL_FIELD_BIT_OFFS_VALID); + SCST_INVAL_FIELD_BIT_OFFS_VALID); return 1; } @@ -15692,8 +15692,7 @@ int __init scst_lib_init(void) scst_scsi_op_list_init(); - scst_release_acg_wq = alloc_workqueue("scst_release_acg", 0 - | WQ_UNBOUND, + scst_release_acg_wq = alloc_workqueue("scst_release_acg", WQ_UNBOUND, 0); if (unlikely(!scst_release_acg_wq)) { PRINT_ERROR("Failed to allocate scst_release_acg_wq"); diff --git a/scst/src/scst_local_cmd.c b/scst/src/scst_local_cmd.c index d700b6a61..7bcb4fa1c 100644 --- a/scst/src/scst_local_cmd.c +++ b/scst/src/scst_local_cmd.c @@ -303,7 +303,7 @@ static enum scst_exec_res scst_exec_set_tpgs(struct scst_cmd *cmd) PRINT_ERROR("SET TARGET PORT GROUPS: not explicit ALUA mode (dev %s)", dev->virt_name); /* Invalid opcode, i.e. SA field */ - scst_set_invalid_field_in_cdb(cmd, 1, 0 | SCST_INVAL_FIELD_BIT_OFFS_VALID); + scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out; } @@ -415,7 +415,7 @@ static enum scst_exec_res scst_report_supported_opcodes(struct scst_cmd *cmd) req_opcode, cmd->dev->virt_name, cmd->sess->initiator_name); scst_set_invalid_field_in_cdb(cmd, 2, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out_compl; } buf_len = 4 + op->od_cdb_size; @@ -442,7 +442,7 @@ static enum scst_exec_res scst_report_supported_opcodes(struct scst_cmd *cmd) req_opcode, cmd->dev->virt_name, cmd->sess->initiator_name); scst_set_invalid_field_in_cdb(cmd, 2, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out_compl; } if (req_sa != op->od_serv_action) { @@ -465,7 +465,7 @@ static enum scst_exec_res scst_report_supported_opcodes(struct scst_cmd *cmd) default: PRINT_ERROR("REPORT SUPPORTED OPERATION CODES: REPORTING OPTIONS %x not supported (dev %s, initiator %s)", options, cmd->dev->virt_name, cmd->sess->initiator_name); - scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out_compl; } @@ -842,7 +842,7 @@ out_done: return SCST_EXEC_COMPLETED; out_unsup_act: - scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out_complete; } @@ -970,7 +970,7 @@ enum scst_exec_res scst_persistent_reserve_out_local(struct scst_cmd *cmd) scst_pr_register_and_move(cmd, buffer, buffer_size); break; default: - scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out_unlock; } diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index 08a34174b..a4badc826 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -1882,7 +1882,7 @@ void scst_pr_reserve(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) if (!scst_pr_type_valid(type)) { TRACE_PR("Invalid reservation type %d", type); - scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 2, SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out; } @@ -2080,7 +2080,7 @@ static void scst_pr_do_preempt(struct scst_cmd *cmd, uint8_t *buffer, int buffer if (!scst_pr_type_valid(type)) { TRACE_PR("Invalid reservation type %d", type); - scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + scst_set_invalid_field_in_cdb(cmd, 1, SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out; } diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index a9b2423b3..aedcd8736 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -3222,8 +3222,9 @@ static ssize_t scst_dev_sysfs_pr_file_name_store(struct kobject *kobj, struct ko PRINT_ERROR("Unable to kasprintf() PR file name"); goto out; } - p = pr_file_name; - strsep(&p, "\n"); /* strip trailing whitespace */ + p = strchr(pr_file_name, '\n'); + if (p) + *p = '\0'; if (pr_file_name[0] == '\0') { kfree(pr_file_name); pr_file_name = kasprintf(GFP_KERNEL, "%s/%s", SCST_PR_DIR, diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 0b455ec08..3f90c2018 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -1152,7 +1152,7 @@ int scst_parse_cmd(struct scst_cmd *cmd) PRINT_ERROR("Linked commands are not supported (opcode %s)", scst_get_opcode_name(cmd)); scst_set_invalid_field_in_cdb(cmd, cmd->cdb_len - 1, - SCST_INVAL_FIELD_BIT_OFFS_VALID | 0); + SCST_INVAL_FIELD_BIT_OFFS_VALID); goto out_done; } diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index b690a800c..82f1ffee8 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -170,7 +170,7 @@ static int scst_local_get_sas_transport_id(struct scst_local_sess *sess, uint8_t goto out; } - tr_id[0] = 0x00 | SCSI_TRANSPORTID_PROTOCOLID_SAS; + tr_id[0] = SCSI_TRANSPORTID_PROTOCOLID_SAS; /* * Assemble a valid SAS address = 0x5OOUUIIR12345678 ... Does SCST diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 26ea04c44..afb3c0752 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -1649,14 +1649,14 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, if (scst_cmd_get_data_direction(cmd) & SCST_DATA_READ) { if (resid > 0) srp_rsp->flags |= SRP_RSP_FLAG_DIUNDER; - else if (resid < 0) + else srp_rsp->flags |= SRP_RSP_FLAG_DIOVER; srp_rsp->data_in_res_cnt = cpu_to_be32(abs(resid)); } if (scst_cmd_get_data_direction(cmd) & SCST_DATA_WRITE) { if (resid > 0) srp_rsp->flags |= SRP_RSP_FLAG_DOUNDER; - else if (resid < 0) + else srp_rsp->flags |= SRP_RSP_FLAG_DOOVER; srp_rsp->data_out_res_cnt = cpu_to_be32(abs(resid)); } @@ -2651,7 +2651,7 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev, list_add_tail(&ch->ioctx_ring[i]->free_list, &ch->free_list); } if (!sdev->use_srq) { - u16 imm_data_offset = req->req_flags & SRP_IMMED_REQUESTED ? + u16 imm_data_offset = (req->req_flags & SRP_IMMED_REQUESTED) ? be16_to_cpu(req->imm_data_offset) : 0; u16 alignment_offset; u32 req_sz; diff --git a/usr/events/events.c b/usr/events/events.c index 3b7b66fbc..1dd7d1ff5 100644 --- a/usr/events/events.c +++ b/usr/events/events.c @@ -52,7 +52,7 @@ char *app_name; # endif #endif /* DEBUG */ -bool log_daemon = false; /* needed for the tracing infrastructure */ +bool log_daemon; /* needed for the tracing infrastructure */ unsigned long trace_flag = DEFAULT_LOG_FLAGS; #endif /* defined(DEBUG) || defined(TRACING) */ diff --git a/usr/fileio/fileio.c b/usr/fileio/fileio.c index f272adc1b..1725d9055 100644 --- a/usr/fileio/fileio.c +++ b/usr/fileio/fileio.c @@ -69,7 +69,7 @@ char *app_name; unsigned long trace_flag = DEFAULT_LOG_FLAGS; #endif /* defined(DEBUG) || defined(TRACING) */ -bool log_daemon = false; +bool log_daemon; #define DEF_BLOCK_SHIFT 9 #define THREADS 7