ath9k: Fix modal EEPROM dump
authorMohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Tue, 15 May 2012 09:54:47 +0000 (15:24 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 5 Jun 2012 19:23:20 +0000 (15:23 -0400)
we provide excess buffer size for 'simple_read_from_buffer'
for modal EEPROM dump. This results in trailing NULL bytes
at the end of EEPROM dump, fix this.

Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Reported-by: Holger Schurig <holgerschurig@googlemail.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Tested-by: Holger Schurig <holgerschurig@gogglemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
drivers/net/wireless/ath/ath9k/eeprom_4k.c
drivers/net/wireless/ath/ath9k/eeprom_9287.c
drivers/net/wireless/ath/ath9k/eeprom_def.c

index dfb0441f406c24e59c10fac636007d7337cd4b65..f794828c08e2376607eda282965ff003a45d1022 100644 (file)
@@ -3412,11 +3412,11 @@ static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
        if (!dump_base_hdr) {
                len += snprintf(buf + len, size - len,
                                "%20s :\n", "2GHz modal Header");
-               len += ar9003_dump_modal_eeprom(buf, len, size,
+               len = ar9003_dump_modal_eeprom(buf, len, size,
                                                &eep->modalHeader2G);
                len += snprintf(buf + len, size - len,
                                "%20s :\n", "5GHz modal Header");
-               len += ar9003_dump_modal_eeprom(buf, len, size,
+               len = ar9003_dump_modal_eeprom(buf, len, size,
                                                &eep->modalHeader5G);
                goto out;
        }
index 4322ac80c203c1dfc6762f7f8547c73fbf3af7b3..a850f44fa76714e0f506907ac897c48777ab9069 100644 (file)
@@ -135,7 +135,7 @@ static u32 ath9k_hw_4k_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
        if (!dump_base_hdr) {
                len += snprintf(buf + len, size - len,
                                "%20s :\n", "2GHz modal Header");
-               len += ath9k_dump_4k_modal_eeprom(buf, len, size,
+               len = ath9k_dump_4k_modal_eeprom(buf, len, size,
                                                  &eep->modalHeader);
                goto out;
        }
index aa614767adffc8b342a4b37cb5265cbb15c3fad3..cd742fb944c274528ee5cfce31625ba329f42b55 100644 (file)
@@ -132,7 +132,7 @@ static u32 ath9k_hw_ar9287_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
        if (!dump_base_hdr) {
                len += snprintf(buf + len, size - len,
                                "%20s :\n", "2GHz modal Header");
-               len += ar9287_dump_modal_eeprom(buf, len, size,
+               len = ar9287_dump_modal_eeprom(buf, len, size,
                                                &eep->modalHeader);
                goto out;
        }
index b5fba8b18b8b851fbe985820c9d8021729171290..56290f3185208e0e6863f3ee70bb622dd5e04e0b 100644 (file)
@@ -211,11 +211,11 @@ static u32 ath9k_hw_def_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
        if (!dump_base_hdr) {
                len += snprintf(buf + len, size - len,
                                "%20s :\n", "2GHz modal Header");
-               len += ath9k_def_dump_modal_eeprom(buf, len, size,
+               len = ath9k_def_dump_modal_eeprom(buf, len, size,
                                                   &eep->modalHeader[0]);
                len += snprintf(buf + len, size - len,
                                "%20s :\n", "5GHz modal Header");
-               len += ath9k_def_dump_modal_eeprom(buf, len, size,
+               len = ath9k_def_dump_modal_eeprom(buf, len, size,
                                                   &eep->modalHeader[1]);
                goto out;
        }