Files
linux/drivers/scsi
Don Brace 667298ceaf scsi: smartpqi: Fix blocks_per_row static checker issue
Dan Carpenter found a possible divide by 0 issue in the smartpqi driver in
functions pci_get_aio_common_raid_map_values() and pqi_calc_aio_r5_or_r6().
The variable rmd->blocks_per_row is used as a divisor and could be 0.

       Using rmd->blocks_per_row as a divisor without checking
       it for 0 first.

Correct these possible divide by 0 conditions by insuring that
rmd->blocks_per_row is not zero before usage.  The check for non-0 was too
late to prevent a divide by 0 condition.  Add in a comment to explain why
the check for non-zero is necessary. If the member is 0, return
PQI_RAID_BYPASS_INELIGIBLE before any division is performed.

Link: https://lore.kernel.org/linux-scsi/YG%2F5kWHHAr7w5dU5@mwanda/
Link: https://lore.kernel.org/r/161850492435.7302.392780350442938047.stgit@brunhilda
Fixes: 6702d2c40f ("scsi: smartpqi: Add support for RAID5 and RAID6 writes")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-04-15 22:03:32 -04:00
..
2021-01-22 21:14:09 -05:00
2021-03-24 22:58:33 -04:00
2021-03-24 22:54:24 -04:00
2020-03-11 23:07:59 -04:00
2021-04-13 00:16:42 -04:00
2021-04-06 00:50:17 -04:00
2021-04-12 23:21:26 -04:00
2021-01-22 21:14:07 -05:00
2021-01-22 21:14:08 -05:00
2021-01-22 21:14:07 -05:00
2018-06-19 22:02:25 -04:00
2021-01-22 21:14:08 -05:00
2020-02-24 14:54:25 -05:00
2020-03-11 23:07:59 -04:00
2021-03-24 23:07:14 -04:00
2020-09-02 22:49:06 -04:00
2020-08-23 17:36:59 -05:00
2018-11-06 21:31:28 -05:00
2021-04-13 00:20:48 -04:00
2020-12-07 20:24:09 -05:00
2021-01-22 21:14:07 -05:00
2021-01-26 22:11:17 -05:00
2020-12-07 20:24:09 -05:00
2020-12-07 20:24:09 -05:00
2020-08-23 17:36:59 -05:00
2021-03-24 23:03:43 -04:00
2021-03-29 23:09:10 -04:00
2018-06-19 22:02:25 -04:00
2020-12-01 14:53:39 -07:00
2021-03-18 23:35:54 -04:00
2021-04-13 00:20:48 -04:00
2020-02-24 15:01:57 -05:00
2021-01-22 21:14:10 -05:00
2021-04-13 00:20:48 -04:00
2021-01-22 21:14:12 -05:00