netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zorro8390: Fix read buffer overflow in zorro8390_init_one()
@ 2009-08-09 14:00 Roel Kluin
  0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2009-08-09 14:00 UTC (permalink / raw)
  To: David S. Miller, netdev, Andrew Morton

Prevent read from cards[-1] when no card was found.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
is ENODEV appropriate here?

diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c
index 37c84e3..55502e1 100644
--- a/drivers/net/zorro8390.c
+++ b/drivers/net/zorro8390.c
@@ -120,6 +120,9 @@ static int __devinit zorro8390_init_one(struct zorro_dev *z,
     for (i = ARRAY_SIZE(cards)-1; i >= 0; i--)
 	if (z->id == cards[i].id)
 	    break;
+    if (i < 0)
+        return -ENODEV;
+    
     board = z->resource.start;
     ioaddr = board+cards[i].offset;
     dev = alloc_ei_netdev();

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-08-09 13:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-09 14:00 [PATCH] zorro8390: Fix read buffer overflow in zorro8390_init_one() Roel Kluin

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).