Messages in this thread Patch in this message | | | From | Gaurav Singh <> | Subject | [PATCH] [net/wan] cosa_init: check bounds before access | Date | Tue, 23 Jun 2020 21:04:49 -0400 |
| |
Check i < io bounds before accessing io[i].
Signed-off-by: Gaurav Singh <gaurav1086@gmail.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
| |