All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] eexpress: Read buffer overflow
Date: Sun, 26 Jul 2009 23:47:29 +0200	[thread overview]
Message-ID: <4A6CCEF1.3030503@gmail.com> (raw)
In-Reply-To: <4A6CB9A6.4070406@gmail.com>

Jarek Poplawski wrote, On 07/26/2009 10:16 PM:

> Roel Kluin wrote, On 07/25/2009 09:50 PM:
> 
>> start_code is 69 words, but the code always writes a multiple of 16 words,
>> so the last 11 words written are outside the array.
>>
>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>> ---
>> This was observed using Parfait http://research.sun.com/projects/parfait/
>>
>> diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c
>> index 1686dca..e304abb 100644
>> --- a/drivers/net/eexpress.c
>> +++ b/drivers/net/eexpress.c
>> @@ -1474,15 +1474,14 @@ static void eexp_hw_init586(struct net_device *dev)
>>  	outw(0x0000, ioaddr + 0x800c);
>>  	outw(0x0000, ioaddr + 0x800e);
>>  
>> -	for (i = 0; i < (sizeof(start_code)); i+=32) {
>> -		int j;
>> -		outw(i, ioaddr + SM_PTR);
>> -		for (j = 0; j < 16; j+=2)
>> -			outw(start_code[(i+j)/2],
>> -			     ioaddr+0x4000+j);
>> -		for (j = 0; j < 16; j+=2)
>> -			outw(start_code[(i+j+16)/2],
>> -			     ioaddr+0x8000+j);
> 
> 
> (max) i = 64, (max) j = 14, (64+14+16)/2 = 47 < 69, so it seems to copy
> less than its size?


OOPS: (max) i = 128, (max) j = 14, (128+14+16)/2 = 79, so you are right!

Sorry,
Jarek P.

> 
>> +	for (i = 0; i < ARRAY_SIZE(start_code); i += 16) {
>> +		int j, jmax;
>> +		outw(i * 2, ioaddr + SM_PTR);
>> +
>> +		jmax = min_t(int, 16, ARRAY_SIZE(start_code) - i);
>> +		for (j = 0; j < jmax; j++)
>> +			outw(start_code[i + j],
>> +			     ioaddr + j * 2 + (j < 8 ? 0x4000 : 0x8000 - 16));
>>  	}
>>  
>>  	/* Do we want promiscuous mode or multicast? */
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



  reply	other threads:[~2009-07-26 21:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-25 19:50 [PATCH] eexpress: Read buffer overflow Roel Kluin
2009-07-26 20:16 ` Jarek Poplawski
2009-07-26 21:47   ` Jarek Poplawski [this message]
2009-07-27  1:45 ` David Miller
2009-07-29 12:15   ` Roel Kluin
2009-07-29 12:29     ` Jarek Poplawski
2009-07-29 13:18       ` Roel Kluin
2009-07-29 20:05         ` Jarek Poplawski
2009-07-30 20:28           ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A6CCEF1.3030503@gmail.com \
    --to=jarkao2@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=roel.kluin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.