[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200624010450.4490-1-gaurav1086@gmail.com>
Date: Tue, 23 Jun 2020 21:04:49 -0400
From: Gaurav Singh <gaurav1086@...il.com>
To: gaurav1086@...il.com, "Jan \"Yenya\" Kasprzak" <kas@...muni.cz>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev@...r.kernel.org (open list:NETWORKING DRIVERS),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] [net/wan] cosa_init: check bounds before access
Check i < io bounds before accessing io[i].
Signed-off-by: Gaurav Singh <gaurav1086@...il.com>
---
drivers/net/wan/cosa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index 5d6532ad6b78..8797adfa0ab0 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -363,7 +363,7 @@ static int __init cosa_init(void)
}
for (i=0; i<MAX_CARDS; i++)
cosa_cards[i].num = -1;
- for (i=0; io[i] != 0 && i < MAX_CARDS; i++)
+ for (i=0; i < MAX_CARDS && io[i] != 0; i++)
cosa_probe(io[i], irq[i], dma[i]);
if (!nr_cards) {
pr_warn("no devices found\n");
--
2.17.1
Powered by blists - more mailing lists