[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130519125950.GA17651@elgon.mountain>
Date: Sun, 19 May 2013 15:59:50 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Dimitri Sivanich <sivanich@....com>
Cc: Robin Holt <holt@....com>, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [patch] gru: fix a sanity test in gru_set_context_option()
"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@...cle.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 {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists