]> git.baikalelectronics.ru Git - kernel.git/commit
ice: Fix potential infinite loop when using u8 loop counter
authorColin Ian King <colin.king@canonical.com>
Wed, 31 Mar 2021 14:46:28 +0000 (15:46 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 13 Apr 2021 18:50:38 +0000 (11:50 -0700)
commit38e3ced1aec24d67d1dc749e81fc09b9ae4f5b04
tree14c8e914aa1bc07994b71531b938e1ba6fceb3f0
parent433db56d6af06b0a4f1ae59583d7a8f5e3fd3021
ice: Fix potential infinite loop when using u8 loop counter

A for-loop is using a u8 loop counter that is being compared to
a u32 cmp_dcbcfg->numapp to check for the end of the loop. If
cmp_dcbcfg->numapp is larger than 255 then the counter j will wrap
around to zero and hence an infinite loop occurs. Fix this by making
counter j the same type as cmp_dcbcfg->numapp.

Addresses-Coverity: ("Infinite loop")
Fixes: a0a8d42af356 ("ice: Recognize 860 as iSCSI port in CEE mode")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_dcb.c