From: David Miller <davem@davemloft.net>
To: roel.kluin@gmail.com
Cc: netdev@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH] eexpress: Read buffer overflow
Date: Sun, 26 Jul 2009 18:45:55 -0700 (PDT) [thread overview]
Message-ID: <20090726.184555.56450167.davem@davemloft.net> (raw)
In-Reply-To: <4A6B61FB.4050304@gmail.com>
From: Roel Kluin <roel.kluin@gmail.com>
Date: Sat, 25 Jul 2009 21:50:19 +0200
> - 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);
> + 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));
This new IO address expression:
ioaddr + j * 2 + (j < 8 ? 0x4000 : 0x8000 - 16)
DOES NOT match what the existing code does. That 0x8000 - 16 seems
incorrect, the existing code always writes starting at 0x8000
in two byte increments, it does not start at 0x8000 - 16....
Oh nevermind, I see what you're doing. Once j gets to 8, we have
to account for that in the IO address computation.
You've murdered this code, it's even more obfuscated now than it was
previously. I'm not applying this, no way. To a fix an out of
bounds array access you're going to change the loop iteration factors
and all of the sub-expressions within' 3 loops too? Get real.
Just add the necessary limit tests, and nothing more, so it's
possible to actually understand your patch. If it's more than
a 3 line patch, I'm not even going to review it.
next prev parent reply other threads:[~2009-07-27 1:45 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
2009-07-27 1:45 ` David Miller [this message]
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=20090726.184555.56450167.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=akpm@linux-foundation.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).