public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] leds: netxbig: off by one in netxbig_leds_get_of_pdata()
@ 2015-04-09  9:05 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-04-09  9:05 UTC (permalink / raw)
  To: Bryan Wu; +Cc: Richard Purdie, linux-leds, kernel-janitors

The mode_val[] array has NETXBIG_LED_MODE_NUM (5) elements so the ">"
here should be ">=".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c
index 028686f2..d0b743c 100644
--- a/drivers/leds/leds-netxbig.c
+++ b/drivers/leds/leds-netxbig.c
@@ -512,7 +512,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
 						   "mode-val", 2 * i, &mode);
 			of_property_read_u32_index(child,
 						   "mode-val", 2 * i + 1, &val);
-			if (mode > NETXBIG_LED_MODE_NUM)
+			if (mode >= NETXBIG_LED_MODE_NUM)
 				return -EINVAL;
 			mode_val[mode] = val;
 		}

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-04-09  9:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-09  9:05 [patch 1/2] leds: netxbig: off by one in netxbig_leds_get_of_pdata() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox