mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: mt7915: fix potential overflow of eeprom page index [update]
If total eeprom size is divisible by per-page size, the i in for loop
will exceed max page index, which happens in our newer chipset.
Fixes: 26f18380e6ca ("mt76: mt7915: add support for flash mode")
Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
affea639c5
commit
ac00fed412
+1
-1
@@ -3258,7 +3258,7 @@ static int mt7915_mcu_set_eeprom_flash(struct mt7915_dev *dev)
|
||||
struct sk_buff *skb;
|
||||
int ret;
|
||||
|
||||
if (i == total - 1 && MT7915_EEPROM_SIZE % PER_PAGE_SIZE)
|
||||
if (i == total - 1 && !!(MT7915_EEPROM_SIZE % PER_PAGE_SIZE))
|
||||
eep_len = MT7915_EEPROM_SIZE % PER_PAGE_SIZE;
|
||||
else
|
||||
eep_len = PER_PAGE_SIZE;
|
||||
|
||||
Reference in New Issue
Block a user