From: Gaurav Singh <gaurav1086@gmail.com>
To: gaurav1086@gmail.com, "Jan \"Yenya\" Kasprzak" <kas@fi.muni.cz>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org (open list:NETWORKING DRIVERS),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] [net/wan] cosa_init: check bounds before access
Date: Tue, 23 Jun 2020 21:04:49 -0400 [thread overview]
Message-ID: <20200624010450.4490-1-gaurav1086@gmail.com> (raw)
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
next reply other threads:[~2020-06-24 1:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-24 1:04 Gaurav Singh [this message]
2020-06-24 3:20 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200624010450.4490-1-gaurav1086@gmail.com \
--to=gaurav1086@gmail.com \
--cc=davem@davemloft.net \
--cc=kas@fi.muni.cz \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®