1. 22 Feb, 2023 4 commits
    • Kees Cook's avatar
      scsi: mpi3mr: Replace 1-element array with flex-array · c6f2e6b6
      Kees Cook authored
      Nothing else defined MPI3_NVME_ENCAP_CMD_MAX, so the "command" buffer was
      being defined as a fake flexible array of size 1. Replace this with a
      proper flex array. Avoids this GCC 13 warning under -fstrict-flex-arrays=3:
      
      In function 'fortify_memset_chk',
          inlined from 'mpi3mr_build_nvme_sgl' at ../drivers/scsi/mpi3mr/mpi3mr_app.c:693:2,
          inlined from 'mpi3mr_bsg_process_mpt_cmds.constprop' at ../drivers/scsi/mpi3mr/mpi3mr_app.c:1214:8:
      ../include/linux/fortify-string.h:430:25: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()?  [-Wattribute-warning]
        430 |                         __write_overflow_field(p_size_field, size);
            |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Link: https://lore.kernel.org/r/20230204183715.never.937-kees@kernel.org
      Cc: Sumit Saxena <sumit.saxena@broadcom.com>
      Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: kernel test robot <lkp@intel.com>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      c6f2e6b6
    • Arnd Bergmann's avatar
      scsi: ipr: Work around fortify-string warning · ee4e7dfe
      Arnd Bergmann authored
      The ipr_log_vpd_compact() function triggers a fortified memcpy() warning
      about a potential string overflow with all versions of clang:
      
      In file included from drivers/scsi/ipr.c:43:
      In file included from include/linux/string.h:254:
      include/linux/fortify-string.h:520:4: error: call to '__write_overflow_field' declared with 'warning' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
                              __write_overflow_field(p_size_field, size);
                              ^
      include/linux/fortify-string.h:520:4: error: call to '__write_overflow_field' declared with 'warning' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
      2 errors generated.
      
      I don't see anything actually wrong with the function, but this is the only
      instance I can reproduce of the fortification going wrong in the kernel at
      the moment, so the easiest solution may be to rewrite the function into
      something that does not trigger the warning.
      
      Instead of having a combined buffer for vendor/device/serial strings, use
      three separate local variables and just truncate the whitespace
      individually.
      
      Link: https://lore.kernel.org/r/20230214132831.2118392-1-arnd@kernel.org
      Cc: Kees Cook <keescook@chromium.org>
      Fixes: 8cf093e2 ("[SCSI] ipr: Improved dual adapter errors")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Acked-by: default avatarBrian King <brking@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      ee4e7dfe
    • Deepak R Varma's avatar
      scsi: ipr: Make ipr_probe_ioa_part2() return void · 3a2d1efa
      Deepak R Varma authored
      Convert function ipr_probe_ioa_part2() to return void instead of int since
      the current implementation always returns 0 to the caller.  The
      transformation also eliminates the dead code when calling
      ipr_probe_ioa_part2() function.  Issue identified using returnvar
      Coccinelle semantic patch.
      
      Link: https://lore.kernel.org/r/Y7rvQyMOGcPKPTv8@ubun2204.myguest.virtualbox.orgSigned-off-by: default avatarDeepak R Varma <drv@mailo.com>
      Acked-by: default avatarBrian King <brking@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      3a2d1efa
    • Xingui Yang's avatar
      scsi: sd: Update DIX config every time sd_revalidate_disk() is called · 26a02d97
      Xingui Yang authored
      If a controller has DIX is enabled and an attached disk is formatted using
      a protection type supported by the controller, a block integrity profile is
      registered to enable protected transfers.
      
      If the disk is subsequently reformatted to disable PI, and the controller
      does not support DIX Type 0, this can lead to failures such as this:
      
      [142829.032340] hisi_sas_v3_hw 0000:b4:04.0: erroneous completion iptt=2375 task=00000000bea0970c dev id=5 direct-attached phy4 addr=51c20dbaf642a000 CQ hdr: 0x1023 0x50947 0x0 0x20000 Error info: 0x0 0x0 0x4 0x0
      [142829.073883] sas: Enter sas_scsi_recover_host busy: 1 failed: 1
      [142829.079783] sas: sas_scsi_find_task: aborting task 0x00000000bea0970c
      [142829.102342] sas: Internal abort: task to dev 51c20dbaf642a000 response: 0x0 status 0x5
      [142829.110319] sas: sas_eh_handle_sas_errors: task 0x00000000bea0970c is done
      [142829.117275] sd 7:0:5:0: [sdc] tag#2375 UNKNOWN(0x2003) Result: hostbyte=0x05 driverbyte=DRIVER_OK cmd_age=0s
      [142829.127171] sd 7:0:5:0: [sdc] tag#2375 CDB: opcode=0x2a 2a 00 00 00 00 00 00 00 08 00
      [142829.135059] I/O error, dev sdc, sector 0 op 0x1:(WRITE) flags 0x18800 phys_seg 1 prio class 2
      
      This is because the block layer integrity profile is currently only set up
      the first time a disk is discovered.
      
      To address this, remove the first_scan check when configuring protection
      information during revalidate. Also unregister the block integrity profile
      if DIX is not supported with a given protection type.
      
      [mkp: commit description + printk dedup]
      
      Link: https://lore.kernel.org/r/20230221081026.24736-1-yangxingui@huawei.comSigned-off-by: default avatarXingui Yang <yangxingui@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      26a02d97
  2. 21 Feb, 2023 11 commits
  3. 09 Feb, 2023 5 commits
  4. 08 Feb, 2023 12 commits
  5. 04 Feb, 2023 1 commit
    • Arnd Bergmann's avatar
      scsi: ufs: qcom: fix platform_msi_domain_free_irqs() reference · 49f262bc
      Arnd Bergmann authored
      The newly added MSI support is mostly hidden inside of an #ifdef,
      except for one line that now causes a build failure when MSI
      is disabled:
      
      drivers/ufs/host/ufs-qcom.c: In function 'ufs_qcom_remove':
      drivers/ufs/host/ufs-qcom.c:1698:9: error: implicit declaration of function 'platform_msi_domain_free_irqs' [-Werror=i]
       1698 |         platform_msi_domain_free_irqs(hba->dev);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Above that, the symbol that guards the other call was recently removed, so
      that is all dead code at the moment.
      
      Remove the incorrect #ifdef and instead of a Kconfig dependency to only
      allow building the driver when CONFIG_GENERIC_MSI_IRQ is enabled. This
      symbol is always present when PCI_MSI or ARM_GIC_V3_ITS are enabled, both
      of which should be present on kernels that can run on Qualcomm SoCs.
      
      The 'select RESET_CONTROLLER' in combination with this dependency
      unfortunately causes a dependency loop and this is a user-visible symbol,
      so it's better to change both to 'depends on'.
      
      Link: https://lore.kernel.org/r/20230126211831.2274211-1-arnd@kernel.org
      Fixes: 519b6274 ("scsi: ufs: qcom: Add MCQ ESI config vendor specific ops")
      Fixes: 13e7accb ("genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarManivannan Sadhasivam <mani@kernel.org>
      Acked-by: default avatarCan Guo <quic_cang@quicinc.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      49f262bc
  6. 24 Jan, 2023 7 commits