mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [patch] off by one error in rioctrl.c
Date: Fri, 7 Aug 2009 14:10:45 +0200 (SAST)	[thread overview]
Message-ID: <alpine.DEB.2.00.0908032147520.6185@bicker> (raw)

I'm not sure who to send this to.

If DownLoad.ProductCode == MAX_PRODUCT, that would be a problem when we do 
RIOBootTable[DownLoad.ProductCode] a couple lines down.

Found by smatch (http://repo.or.cz/w/smatch.git).

regards,
dan carpenter


Signed-off-by: Dan Carpenter <error27@gmail.com>

--- orig/drivers/char/rio/rioctrl.c	2009-08-03 21:44:01.000000000 +0200
+++ devel/drivers/char/rio/rioctrl.c	2009-08-03 21:44:26.000000000 +0200
@@ -873,7 +873,7 @@
 		/*
 		 ** It is important that the product code is an unsigned object!
 		 */
-		if (DownLoad.ProductCode > MAX_PRODUCT) {
+		if (DownLoad.ProductCode >= MAX_PRODUCT) {
 			rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", DownLoad.ProductCode);
 			p->RIOError.Error = NO_SUCH_PRODUCT;
 			return -ENXIO;

                 reply	other threads:[~2009-08-07 12:10 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=alpine.DEB.2.00.0908032147520.6185@bicker \
    --to=error27@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®