All of lore.kernel.org
 help / color / mirror / Atom feed
* [ath9k-devel] smatch stuff: potential read past the end of the buffer
@ 2010-12-20  8:30 ` Dan Carpenter
  0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2010-12-20  8:30 UTC (permalink / raw)
  To: ath9k-devel

Hello Vasanthakumar,

Smatch complains that in linux-next 60e0c3a7 "ath9k_hw: Eeeprom changes
for AR9485" means there is a potential read past the end of the buffer
int ar9300_eeprom_restore_internal().

drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +3381
	ar9300_eeprom_restore_internal(81)
	error: buffer overflow 'word' 2048 <= 4099

"word" is allocated with 2048 bytes:
        word = kzalloc(2048, GFP_KERNEL);

"length" can be up to 4099:
                if ((!AR_SREV_9485(ah) && length >= 1024) ||
                    (AR_SREV_9485(ah) && length >= (4 * 1024))) {
                                         ^^^^^^^^^^^^^^^^^^^^^

so "osize" can be up to 4099 as well:
                osize = length;

We're reading way past the end of the word array here:
                mchecksum = word[COMP_HDR_LEN + osize] |
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
                    (word[COMP_HDR_LEN + osize + 1] << 8);

I don't know how to fix this.  Can you take a look?

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-12-21  7:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-20  8:30 [ath9k-devel] smatch stuff: potential read past the end of the buffer Dan Carpenter
2010-12-20  8:30 ` Dan Carpenter
2010-12-20  9:26 ` [ath9k-devel] " Senthil Balasubramanian
2010-12-20  9:26   ` Senthil Balasubramanian
2010-12-20 10:16 ` [ath9k-devel] " Arend Van Spriel
2010-12-20 10:16   ` Arend Van Spriel
2010-12-20 12:42   ` [ath9k-devel] " Dan Carpenter
2010-12-20 12:42     ` Dan Carpenter
2010-12-20 17:13     ` [ath9k-devel] " Arend Van Spriel
2010-12-20 17:13       ` Arend Van Spriel
2010-12-21  7:29 ` [ath9k-devel] " Vasanthakumar Thiagarajan
2010-12-21  7:29   ` Vasanthakumar Thiagarajan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.