linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [net/wan] cosa_init: check bounds before access
@ 2020-06-24  1:04 Gaurav Singh
  2020-06-24  3:20 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Gaurav Singh @ 2020-06-24  1:04 UTC (permalink / raw)
  To: gaurav1086, Jan "Yenya" Kasprzak, David S. Miller,
	Jakub Kicinski, open list:NETWORKING DRIVERS, open list

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] [net/wan] cosa_init: check bounds before access
  2020-06-24  1:04 [PATCH] [net/wan] cosa_init: check bounds before access Gaurav Singh
@ 2020-06-24  3:20 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-06-24  3:20 UTC (permalink / raw)
  To: gaurav1086; +Cc: kas, kuba, netdev, linux-kernel

From: Gaurav Singh <gaurav1086@gmail.com>
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>

The io[] array is intentionally zero terminated, there is no problem.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-24  3:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24  1:04 [PATCH] [net/wan] cosa_init: check bounds before access Gaurav Singh
2020-06-24  3:20 ` David Miller

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