]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: pm80xx: Fix potential infinite loop
authorColin Ian King <colin.king@canonical.com>
Wed, 7 Apr 2021 13:58:40 +0000 (14:58 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 13 Apr 2021 03:20:42 +0000 (23:20 -0400)
commit67c77b7c8921855f688e4e0b7f82dafa8c2e1598
tree63c1040ac55aa0a90c6ea93b6a663763d9c69826
parent742a1d088fd96fa31b7277805ec6c9eba9682e04
scsi: pm80xx: Fix potential infinite loop

The for-loop iterates with a u8 loop counter i and compares this with the
loop upper limit of pm8001_ha->max_q_num which is a u32 type.  There is a
potential infinite loop if pm8001_ha->max_q_num is larger than the u8 loop
counter. Fix this by making the loop counter the same type as
pm8001_ha->max_q_num.

[mkp: this is purely theoretical, max_q_num is currently limited to 64]

Link: https://lore.kernel.org/r/20210407135840.494747-1-colin.king@canonical.com
Fixes: 9ac55a5b58d3 ("scsi: pm80xx: Fix chip initialization failure")
Addresses-Coverity: ("Infinite loop")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/pm8001/pm8001_hwi.c