[patch] scsi: gdth: fix bad integer overflow check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

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) {
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux