mbox series

[0/2] smartpqi fix static checker issues

Message ID 161850488487.7302.7018870513204678832.stgit@brunhilda (mailing list archive)
Headers show
Series smartpqi fix static checker issues | expand

Message

Don Brace April 15, 2021, 4:41 p.m. UTC
These patches are based on Martin Peterson's 5.13/scsi-queue tree

This set corrects two static checker warnings found by
Dan Carpenter <dan.carpenter@oracle.com>

smartpqi-fix-blocks_per_row-static-checker-issue
 Link: https://lore.kernel.org/linux-scsi/YG%2F5kWHHAr7w5dU5@mwanda/
 Fixes: 6702d2c40f31 ("scsi: smartpqi: Add support for RAID5 and RAID6 writes")
        Using rmd->blocks_per_row as a divisor without checking
        it for 0 first.
 The variable blocks_per_row is used as a divisor in many
 raid_map calculations. This can lead to a divide by 0.
 This patch prevents a possible divide by 0. If the member
 is 0, return PQI_RAID_BYPASS_INELIGIBLE before any division is
 performed. The current check for a non-0 value was after multiple
 divisions were performed.

smartpqi-fix-device-pointer-variable-reference
 Link: ("https://www.mail-archive.com/kbuild@lists.01.org/msg06329.html")
 Fixes: ec504b23df9d ("[304/324] scsi: smartpqi: Add phy ID support for the physical drives")
        drivers/scsi/smartpqi/smartpqi_sas_transport.c:97
        pqi_sas_port_add_rphy() warn: variable dereferenced before
        check 'pqi_sas_port->device' (see line 95)
 In function pqi_sas_port_add_rphy there is a pointer dereference
 without a check for NULL value. Correct this by moving the
 pointer dereference after the check for non-NULL value.

Note: I could not find the e-mail for
      smartpqi-fix-device-pointer-variable-reference issue in
      lore.kernel.org so I used mail-archive.com.
      It may have not been forwarded to lore.kernel.org. Not sure.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: kernel test robot <lkp@intel.com>

---

Don Brace (2):
      smartpqi: fix blocks_per_row static checker issue
      smartpqi: fix device pointer variable reference static checker issue


 drivers/scsi/smartpqi/smartpqi_sas_transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
Signature

Comments

Martin K. Petersen April 16, 2021, 2:03 a.m. UTC | #1
Don,

> This set corrects two static checker warnings found by Dan Carpenter
> <dan.carpenter@oracle.com>

Applied to 5.13/scsi-staging, thanks!
Martin K. Petersen April 20, 2021, 2:29 a.m. UTC | #2
On Thu, 15 Apr 2021 11:41:58 -0500, Don Brace wrote:

> These patches are based on Martin Peterson's 5.13/scsi-queue tree
> 
> This set corrects two static checker warnings found by
> Dan Carpenter <dan.carpenter@oracle.com>
> 
> smartpqi-fix-blocks_per_row-static-checker-issue
>  Link: https://lore.kernel.org/linux-scsi/YG%2F5kWHHAr7w5dU5@mwanda/
>  Fixes: 6702d2c40f31 ("scsi: smartpqi: Add support for RAID5 and RAID6 writes")
>         Using rmd->blocks_per_row as a divisor without checking
>         it for 0 first.
>  The variable blocks_per_row is used as a divisor in many
>  raid_map calculations. This can lead to a divide by 0.
>  This patch prevents a possible divide by 0. If the member
>  is 0, return PQI_RAID_BYPASS_INELIGIBLE before any division is
>  performed. The current check for a non-0 value was after multiple
>  divisions were performed.
> 
> [...]

Applied to 5.13/scsi-queue, thanks!

[1/2] smartpqi: fix blocks_per_row static checker issue
      https://git.kernel.org/mkp/scsi/c/667298ceaf04
[2/2] smartpqi: fix device pointer variable reference static checker issue
      https://git.kernel.org/mkp/scsi/c/5cad5a507241