Skip to content
  1. Oct 17, 2018
    • YueHaibing's avatar
      scsi: lpfc: Remove set but not used variable 'psli' · f41d84d4
      YueHaibing authored
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/scsi/lpfc/lpfc_hbadisc.c: In function 'lpfc_free_tx':
      drivers/scsi/lpfc/lpfc_hbadisc.c:5431:19: warning:
       variable 'psli' set but not used [-Wunused-but-set-variable]
      
      Since commit 895427bd
      
       ("scsi: lpfc: NVME Initiator: Base modifications")
      'psli' is not used any more.
      
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      f41d84d4
    • Nathan Chancellor's avatar
      scsi: bfa: Avoid implicit enum conversion in bfad_im_post_vendor_event · 761c830e
      Nathan Chancellor authored
      
      
      Clang warns when one enumerated type is implicitly converted to another.
      
      drivers/scsi/bfa/bfa_fcs_lport.c:379:26: warning: implicit conversion
      from enumeration type 'enum bfa_lport_aen_event' to different
      enumeration type 'enum bfa_ioc_aen_event' [-Wenum-conversion]
                                        BFA_AEN_CAT_LPORT, event);
                                                           ^~~~~
      
      The root cause of these warnings is the bfad_im_post_vendor_event
      function, which expects a value from enum bfa_ioc_aen_event but there
      are multiple instances of values from enums bfa_port_aen_event,
      bfa_audit_aen_event, and bfa_lport_aen_event being used in this
      function.
      
      Given that this doesn't appear to be a problem since cat helps with
      differentiating the events, just change evt's type to int so that no
      conversion needs to happen and Clang won't warn. Update aen_type's type
      in bfa_aen_entry_s as members that hold enumerated types should be int.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/147
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      761c830e
    • Nathan Chancellor's avatar
      scsi: isci: Change sci_controller_start_task's return type to sci_status · 362b5da3
      Nathan Chancellor authored
      
      
      Clang warns when an enumerated type is implicitly converted to another.
      
      drivers/scsi/isci/request.c:3476:13: warning: implicit conversion from
      enumeration type 'enum sci_task_status' to different enumeration type
      'enum sci_status' [-Wenum-conversion]
                              status = sci_controller_start_task(ihost,
                                     ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/scsi/isci/host.c:2744:10: warning: implicit conversion from
      enumeration type 'enum sci_status' to different enumeration type 'enum
      sci_task_status' [-Wenum-conversion]
                      return SCI_SUCCESS;
                      ~~~~~~ ^~~~~~~~~~~
      drivers/scsi/isci/host.c:2753:9: warning: implicit conversion from
      enumeration type 'enum sci_status' to different enumeration type 'enum
      sci_task_status' [-Wenum-conversion]
              return status;
              ~~~~~~ ^~~~~~
      
      Avoid all of these implicit conversion by just making
      sci_controller_start_task use sci_status. This silences
      Clang and has no functional change since sci_task_status
      has all of its values mapped to something in sci_status.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/153
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      362b5da3
    • Nathan Chancellor's avatar
      scsi: isci: Use proper enumerated type in atapi_d2h_reg_frame_handler · e9e9a103
      Nathan Chancellor authored
      
      
      Clang warns when one enumerated type is implicitly converted to another.
      
      drivers/scsi/isci/request.c:1629:13: warning: implicit conversion from
      enumeration type 'enum sci_io_status' to different enumeration type
      'enum sci_status' [-Wenum-conversion]
                              status = SCI_IO_FAILURE_RESPONSE_VALID;
                                     ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/scsi/isci/request.c:1631:12: warning: implicit conversion from
      enumeration type 'enum sci_io_status' to different enumeration type
      'enum sci_status' [-Wenum-conversion]
                      status = SCI_IO_FAILURE_RESPONSE_VALID;
                             ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      status is of type sci_status but SCI_IO_FAILURE_RESPONSE_VALID is of
      type sci_io_status. Use SCI_FAILURE_IO_RESPONSE_VALID, which is from
      sci_status and has SCI_IO_FAILURE_RESPONSE_VALID's exact value since
      that is what SCI_IO_FAILURE_RESPONSE_VALID is mapped to in the isci.h
      file.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/153
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      e9e9a103
    • YueHaibing's avatar
      scsi: lpfc: Remove set but not used variables 'fc_hdr' and 'hw_page_size' · feb59a34
      YueHaibing authored
      
      
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/scsi/lpfc/lpfc_sli.c: In function 'lpfc_sli4_sp_handle_rcqe':
      drivers/scsi/lpfc/lpfc_sli.c:13430:26: warning:
       variable 'fc_hdr' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/lpfc/lpfc_sli.c: In function 'lpfc_cq_create':
      drivers/scsi/lpfc/lpfc_sli.c:14852:11: warning:
       variable 'hw_page_size' set but not used [-Wunused-but-set-variable]
      
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      feb59a34
    • Varun Prakash's avatar
      scsi: cxgb4i: add DCB support for iSCSI connections · b5a5fe4e
      Varun Prakash authored
      
      
      Add IEEE and CEE DCBX support for iSCSI connections.
      
      Signed-off-by: default avatarRohit Maheshwari <rohitm@chelsio.com>
      Signed-off-by: default avatarVarun Prakash <varun@chelsio.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      b5a5fe4e
    • YueHaibing's avatar
      scsi: megaraid_mbox: remove set but not used variables · 13eb34b6
      YueHaibing authored
      
      
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/scsi/megaraid/megaraid_mbox.c: In function 'megaraid_reset_handler':
      drivers/scsi/megaraid/megaraid_mbox.c:2580:7: warning:
       variable 'recovering' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/megaraid/megaraid_mbox.c: In function 'mbox_post_sync_cmd':
      drivers/scsi/megaraid/megaraid_mbox.c:2728:12: warning:
       variable 'mbox64' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/megaraid/megaraid_mbox.c: In function 'megaraid_mbox_support_random_del':
      drivers/scsi/megaraid/megaraid_mbox.c:3138:11: warning:
       variable 'mbox' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/megaraid/megaraid_mbox.c: In function 'megaraid_mbox_flush_cache':
      drivers/scsi/megaraid/megaraid_mbox.c:3266:10: warning:
       variable 'mbox' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/megaraid/megaraid_mbox.c: In function 'megaraid_mbox_fire_sync_cmd':
      drivers/scsi/megaraid/megaraid_mbox.c:3302:12: warning:
       variable 'mbox64' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/megaraid/megaraid_mbox.c: In function 'gather_hbainfo':
      drivers/scsi/megaraid/megaraid_mbox.c:3797:10: warning:
       variable 'dmajor' set but not used [-Wunused-but-set-variable]
      
      [mkp: applied by hand due to conflict with hch's DMA cleanup]
      
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      13eb34b6
    • Nathan Chancellor's avatar
      scsi: qla2xxx: Simplify conditional check · 0bfe7d3c
      Nathan Chancellor authored
      
      
      Clang generates a warning when it sees a logical not followed by a
      conditional operator like ==, >, or < because it thinks that the logical
      not should be applied to the whole statement:
      
      drivers/scsi/qla2xxx/qla_nx.c:3702:7: warning: logical not is only
      applied to the left hand side of this comparison
      [-Wlogical-not-parentheses]
                      if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0,
                          ^
      drivers/scsi/qla2xxx/qla_nx.c:3702:7: note: add parentheses after the
      '!' to evaluate the comparison first
                      if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0,
                          ^
                           (
      drivers/scsi/qla2xxx/qla_nx.c:3702:7: note: add parentheses around left
      hand side expression to silence this warning
                      if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0,
                          ^
                          (
      1 warning generated.
      
      It assumes the author might have made a mistake in their logic:
      
      if (!a == b) -> if (!(a == b))
      
      Sometimes that is the case; other times, it's just a super convoluted
      way of saying 'if (a)' when b = 0:
      
      if (!1 == 0) -> if (0 == 0) -> if (true)
      
      Alternatively:
      
      if (!1 == 0) -> if (!!1) -> if (1)
      
      Simplify this comparison so that Clang doesn't complain.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/80
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      0bfe7d3c
    • Nathan Chancellor's avatar
      scsi: bfa: Remove unused functions · 6498cbc5
      Nathan Chancellor authored
      Clang warns when a variable is assigned to itself.
      
      drivers/scsi/bfa/bfa_fcbuild.c:199:6: warning: explicitly assigning
      value of variable of type 'int' to itself [-Wself-assign]
              len = len;
              ~~~ ^ ~~~
      drivers/scsi/bfa/bfa_fcbuild.c:838:6: warning: explicitly assigning
      value of variable of type 'int' to itself [-Wself-assign]
              len = len;
              ~~~ ^ ~~~
      drivers/scsi/bfa/bfa_fcbuild.c:917:6: warning: explicitly assigning
      value of variable of type 'int' to itself [-Wself-assign]
              len = len;
              ~~~ ^ ~~~
      drivers/scsi/bfa/bfa_fcbuild.c:981:6: warning: explicitly assigning
      value of variable of type 'int' to itself [-Wself-assign]
              len = len;
              ~~~ ^ ~~~
      drivers/scsi/bfa/bfa_fcbuild.c:1008:6: warning: explicitly assigning
      value of variable of type 'int' to itself [-Wself-assign]
              len = len;
              ~~~ ^ ~~~
      5 warnings generated.
      
      This construct is usually used to avoid unused variable warnings, which
      I assume is the case here. -Wunused-parameter is hidden behind -Wextra
      with GCC 4.6, which is the minimum version to compile the kernel as of
      commit cafa0010
      
       ("Raise the minimum required gcc version to 4.6").
      
      However, upon further inspection, these functions aren't actually used
      anywhere; they're just defined. Rather than just removing the self
      assignments, remove all of this dead code.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/148
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      6498cbc5
    • Nathan Chancellor's avatar
      scsi: qla2xxx: Remove unnecessary self assignment · 3e59790e
      Nathan Chancellor authored
      Clang warns when a variable is assigned to itself.
      
      drivers/scsi/qla2xxx/qla_mbx.c:1514:4: warning: explicitly assigning
      value of variable of type 'uint64_t' (aka 'unsigned long long') to
      itself [-Wself-assign]
              l = l;
              ~ ^ ~
      1 warning generated.
      
      This construct is usually used to avoid unused variable warnings, which
      I assume is the case here. -Wunused-parameter is hidden behind -Wextra
      with GCC 4.6, which is the minimum version to compile the kernel as of
      commit cafa0010
      
       ("Raise the minimum required gcc version to 4.6").
      Just remove this line to silence Clang.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/83
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      3e59790e
    • YueHaibing's avatar
      scsi: arcmsr: Remove set but not used variables 'id, lun' · 242b4a39
      YueHaibing authored
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/scsi/arcmsr/arcmsr_hba.c: In function 'arcmsr_drain_donequeue':
      drivers/scsi/arcmsr/arcmsr_hba.c:1320:10: warning:
       variable 'lun' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/arcmsr/arcmsr_hba.c:1320:6: warning:
       variable 'id' set but not used [-Wunused-but-set-variable]
      
      Never used since introduction in commit ae52e7f0
      
       ("arcmsr: Support 1024 scatter-gather list entries and improve AP while FW trapped and behaviors of EHs").
      
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      242b4a39
    • Wenwen Wang's avatar
      scsi: megaraid_sas: fix a missing-check bug · 47db7873
      Wenwen Wang authored
      
      
      In megasas_mgmt_compat_ioctl_fw(), to handle the structure
      compat_megasas_iocpacket 'cioc', a user-space structure megasas_iocpacket
      'ioc' is allocated before megasas_mgmt_ioctl_fw() is invoked to handle
      the packet. Since the two data structures have different fields, the data
      is copied from 'cioc' to 'ioc' field by field. In the copy process,
      'sense_ptr' is prepared if the field 'sense_len' is not null, because it
      will be used in megasas_mgmt_ioctl_fw(). To prepare 'sense_ptr', the
      user-space data 'ioc->sense_off' and 'cioc->sense_off' are copied and
      saved to kernel-space variables 'local_sense_off' and 'user_sense_off'
      respectively. Given that 'ioc->sense_off' is also copied from
      'cioc->sense_off', 'local_sense_off' and 'user_sense_off' should have the
      same value. However, 'cioc' is in the user space and a malicious user can
      race to change the value of 'cioc->sense_off' after it is copied to
      'ioc->sense_off' but before it is copied to 'user_sense_off'. By doing
      so, the attacker can inject different values into 'local_sense_off' and
      'user_sense_off'. This can cause undefined behavior in the following
      execution, because the two variables are supposed to be same.
      
      This patch enforces a check on the two kernel variables 'local_sense_off'
      and 'user_sense_off' to make sure they are the same after the copy. In
      case they are not, an error code EINVAL will be returned.
      
      Signed-off-by: default avatarWenwen Wang <wang6495@umn.edu>
      Acked-by: default avatarSumit Saxena <sumit.saxena@broadcom.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      47db7873
    • Colin Ian King's avatar
      scsi: be2iscsi: fix spelling mistake "Retreiving" -> "Retrieving" · fd13f051
      Colin Ian King authored
      
      
      Trivial fix to spelling mistake in beiscsi_log message.
      
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      fd13f051
    • Colin Ian King's avatar
      scsi: lpfc: fix spelling mistake "Resrouce" -> "Resource" · c4dba187
      Colin Ian King authored
      
      
      Trivial fix to spelling mistake in lpfc_printf_log message text.
      
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      c4dba187
    • John Garry's avatar
      scsi: hisi_sas: Fix spin lock management in slot_index_alloc_quirk_v2_hw() · fe5fb42d
      John Garry authored
      
      
      Currently a spin_unlock_irqrestore() call is missing on the error path,
      so add it.
      
      Reported-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      fe5fb42d
    • Jens Axboe's avatar
      scsi: sg: remove bad blk_end_request_all() call · abaf75dd
      Jens Axboe authored
      
      
      We just need to free the request here. Additionally, this is currently
      wrong for a queue that's using MQ currently, it'll crash.
      
      Cc: Doug Gilbert <dgilbert@interlog.com>
      Cc: linux-scsi@vger.kernel.org
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      abaf75dd
    • Jens Axboe's avatar
      scsi: osd: initiator should use mq variant of request ending · 8d849275
      Jens Axboe authored
      
      
      This is currently wrong since it isn't dependent on if we're using mq or
      not. At least now it'll be correct when we force mq.
      
      Cc: linux-scsi@vger.kernel.org
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      8d849275
    • Gustavo A. R. Silva's avatar
      scsi: ips: fix missing break in switch · 5d25ff7a
      Gustavo A. R. Silva authored
      
      
      Add missing break statement in order to prevent the code from falling
      through to case TEST_UNIT_READY.
      
      Addresses-Coverity-ID: 1357338 ("Missing break in switch")
      Suggested-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      5d25ff7a
  2. Oct 16, 2018