From 2c30708e811c261a491db247771f2829697aaffa Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 6 Apr 2017 08:12:20 +0300 Subject: [PATCH] ath9k: off by one in ath9k_hw_nvram_read_array() commit b7dcf68f383a05567bd16a390907b67022a62d3d upstream. The > should be >= or we read one space beyond the end of the array. Fixes: ab5c4f71d8c7 ("ath9k: allow to load EEPROM content via firmware API") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- drivers/net/wireless/ath/ath9k/eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c index 2ac05486424b..ddef028875dc 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.c +++ b/drivers/net/wireless/ath/ath9k/eeprom.c @@ -118,7 +118,7 @@ static bool ath9k_hw_nvram_read_blob(struct ath_hw *ah, u32 off, { u16 *blob_data; - if (off * sizeof(u16) > ah->eeprom_blob->size) + if (off * sizeof(u16) >= ah->eeprom_blob->size) return false; blob_data = (u16 *)ah->eeprom_blob->data;