public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Grant Likely <grant.likely@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
	Bill Pemberton <wfp5p@virginia.edu>,
	Huang Shijie <shijie8@gmail.com>,
	linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: mtd: ndfc: silence an underflow static checker warning
Date: Fri, 23 Aug 2013 13:02:06 +0300	[thread overview]
Message-ID: <20130823100206.GS31293@elgon.mountain> (raw)

"cs" is an index into the ndfc_ctrl[].  There is a sanity check which
does:

	if (cs >= NDFC_MAX_CS) {

It doesn't check for underflows and that upsets my static checker.

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

diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 8e148f1..cd78b81 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -201,8 +201,9 @@ static int ndfc_probe(struct platform_device *ofdev)
 {
 	struct ndfc_controller *ndfc;
 	const __be32 *reg;
+	unsigned int cs;
 	u32 ccr;
-	int err, len, cs;
+	int err, len;
 
 	/* Read the reg property to get the chip select */
 	reg = of_get_property(ofdev->dev.of_node, "reg", &len);

                 reply	other threads:[~2013-08-23 10:02 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=20130823100206.GS31293@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=grant.likely@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=rob.herring@calxeda.com \
    --cc=shijie8@gmail.com \
    --cc=wfp5p@virginia.edu \
    /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