[PATCH] ide-cd: unsigned len subtracted below 0?

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

 



len is unsigned, so take care not to subtract below 0.

Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
---
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index ddfbea4..23447a0 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -916,7 +916,10 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
 		xferfunc(drive, NULL, ptr, blen);
 
 		thislen -= blen;
-		len -= blen;
+		if (blen > len)
+			len -= blen;
+		else
+			len = 0;
 
 		if (blk_fs_request(rq)) {
 			rq->buffer += blen;
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux