public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Bryan Wu <cooloney@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>,
	linux-leds@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch 1/2] leds: netxbig: off by one in netxbig_leds_get_of_pdata()
Date: Thu, 09 Apr 2015 09:05:46 +0000	[thread overview]
Message-ID: <20150409090546.GE17605@mwanda> (raw)

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;
 		}

                 reply	other threads:[~2015-04-09  9:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20150409090546.GE17605@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=cooloney@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /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