mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
net: txgbe: Fix unsigned comparison to zero in txgbe_calc_eeprom_checksum()
The error checks on checksum for a negative error return always fails because
it is unsigned and can never be negative.
Fixes: 049fe53653
("net: txgbe: Add operations to interact with firmware")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a068d33e54
commit
5e2ea7801f
1 changed files with 3 additions and 2 deletions
|
@ -200,10 +200,11 @@ static int txgbe_calc_eeprom_checksum(struct txgbe_hw *hw, u16 *checksum)
|
||||||
if (eeprom_ptrs)
|
if (eeprom_ptrs)
|
||||||
kvfree(eeprom_ptrs);
|
kvfree(eeprom_ptrs);
|
||||||
|
|
||||||
*checksum = TXGBE_EEPROM_SUM - *checksum;
|
if (*checksum > TXGBE_EEPROM_SUM)
|
||||||
if (*checksum < 0)
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
*checksum = TXGBE_EEPROM_SUM - *checksum;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue