1. 18 Oct, 2018 18 commits
  2. 17 Oct, 2018 9 commits
  3. 16 Oct, 2018 13 commits
    • 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/80Signed-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/148Signed-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/83Signed-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
    • Bart Van Assche's avatar
      scsi: target/core: Always call transport_complete_callback() upon failure · aa73237d
      Bart Van Assche authored
      COMPARE AND WRITE command execution starts with a call of
      sbc_compare_and_write(). That function locks the caw_sem member in the
      backend device data structure and submits a read request to the backend
      driver. Upon successful completion of the read compare_and_write_callback()
      gets called. That last function compares the data that has been read. If it
      matches transport_complete_callback is set to compare_and_write_post and a
      write request is submitted. compare_and_write_post() submits a write request
      to the backend driver.
      
      XDWRITEREAD command execution starts with sbc_execute_rw() submitting a
      read to the backend device. Upon successful completion of the read the
      xdreadwrite_callback() gets called. That function xors the data that has
      been read with the data in the data-out buffer and stores the result in
      the data-in buffer.
      
      Call transport_complete_callback() not only if COMPARE AND WRITE fails but
      also if XDWRITEREAD fails. This makes the code more systematic. Make sure
      that the callback functions handle (cmd, false, NULL) argument triples fine.
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      aa73237d