public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Achim Leubner <achim_leubner@adaptec.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>,
	linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] scsi: gdth: fix bad integer overflow check
Date: Mon, 22 Dec 2014 07:51:52 +0000	[thread overview]
Message-ID: <20141222075152.GB9737@mwanda> (raw)

The integer overflow check was written incorrectly so it doesn't work.
Whoever wrote this clearly didn't know what they were doing.  (I suck).

Fixes: f63ae56e4e97 ('[SCSI] gdth: integer overflow in ioctl')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 71e1380..0539147 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -4175,7 +4175,7 @@ static int ioc_general(void __user *arg, char *cmnd)
         return -EINVAL;
     if (gen.sense_len > INT_MAX)
         return -EINVAL;
-    if (gen.data_len + gen.sense_len > INT_MAX)
+    if (gen.data_len > INT_MAX - gen.sense_len)
         return -EINVAL;
 
     if (gen.data_len + gen.sense_len != 0) {

                 reply	other threads:[~2014-12-22  7:51 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=20141222075152.GB9737@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=JBottomley@parallels.com \
    --cc=achim_leubner@adaptec.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-scsi@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