From: Dan Carpenter <dan.carpenter@oracle.com>
To: Dimitri Sivanich <sivanich@sgi.com>
Cc: Robin Holt <holt@sgi.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] gru: fix a sanity test in gru_set_context_option()
Date: Sun, 19 May 2013 15:59:50 +0300 [thread overview]
Message-ID: <20130519125950.GA17651@elgon.mountain> (raw)
"req.val1 == -1" is valid but it doesn't make sense to check
gru_base[-1]. gru_base[] is a global array.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c
index c4acac7..e7c37b2 100644
--- a/drivers/misc/sgi-gru/grufault.c
+++ b/drivers/misc/sgi-gru/grufault.c
@@ -876,7 +876,8 @@ int gru_set_context_option(unsigned long arg)
switch (req.op) {
case sco_blade_chiplet:
/* Select blade/chiplet for GRU context */
- if (req.val1 < -1 || req.val1 >= GRU_MAX_BLADES || !gru_base[req.val1] ||
+ if (req.val1 < -1 || req.val1 >= GRU_MAX_BLADES ||
+ (req.val1 != -1 && !gru_base[req.val1]) ||
req.val0 < -1 || req.val0 >= GRU_CHIPLETS_PER_HUB) {
ret = -EINVAL;
} else {
next reply other threads:[~2013-05-19 13:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-19 12:59 Dan Carpenter [this message]
2013-05-19 14:44 ` [patch] gru: fix a sanity test in gru_set_context_option() Dimitri Sivanich
2013-05-19 18:30 ` Dan Carpenter
2013-05-20 13:46 ` Dimitri Sivanich
2013-05-20 18:06 ` Dan Carpenter
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=20130519125950.GA17651@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=holt@sgi.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sivanich@sgi.com \
/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