From: roel kluin Date: Sun, 9 Aug 2009 04:00:25 +0000 (+0000) Subject: zorro8390: Fix read buffer overflow in zorro8390_init_one() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=be12159b24c532b4b48bdec5a543336438faa132;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git zorro8390: Fix read buffer overflow in zorro8390_init_one() Prevent read from cards[-1] when no card was found. Signed-off-by: Roel Kluin Signed-off-by: David S. Miller --- diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c index 37c84e3b8be0..81c753a617ab 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();