Skip to content

Commit

Permalink
ice: fix potential infinite loop
Browse files Browse the repository at this point in the history
The loop counter of a for-loop is a u8 however this is being compared
to an int upper bound and this can lead to an infinite loop if the
upper bound is greater than 255 since the loop counter will wrap back
to zero. Fix this potential issue by making the loop counter an int.

Addresses-Coverity: ("Infinite loop")
Fixes: c7aeb4d ("ice: Disable VFs until reset is completed")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  • Loading branch information
Colin Ian King authored and Jeff Kirsher committed Aug 27, 2019
1 parent 35b4f43 commit a1199d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/ice/ice_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ static void
ice_prepare_for_reset(struct ice_pf *pf)
{
struct ice_hw *hw = &pf->hw;
u8 i;
int i;

/* already prepared for reset */
if (test_bit(__ICE_PREPARED_FOR_RESET, pf->state))
Expand Down

0 comments on commit a1199d6

Please sign in to comment.