diff options
| author | Don Brace <[email protected]> | 2021-04-15 11:42:04 -0500 |
|---|---|---|
| committer | Martin K. Petersen <[email protected]> | 2021-04-15 22:03:32 -0400 |
| commit | 667298ceaf042e28b856478e02cfa2cbe8ed83c6 (patch) | |
| tree | abe9a06e2749e13347b5c092d918b2f54ad32828 /include/linux/fpga/fpga-mgr.h | |
| parent | 15cfef8623a449d40d16541687afd58e78033be3 (diff) | |
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: 6702d2c40f31 ("scsi: smartpqi: Add support for RAID5 and RAID6 writes")
Reported-by: Dan Carpenter <[email protected]>
Reported-by: kernel test robot <[email protected]>
Reviewed-by: Scott Benesh <[email protected]>
Reviewed-by: Scott Teel <[email protected]>
Reviewed-by: Mike McGowen <[email protected]>
Reviewed-by: Kevin Barnett <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'include/linux/fpga/fpga-mgr.h')
0 files changed, 0 insertions, 0 deletions