mtd: OneNAND: Fix test of unsigned in onenand_otp_walk()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Dec 15 23:59:01 EST 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=0a032a4df6dc4a82bcd1c401e57ee71825d30c14
Commit:     0a032a4df6dc4a82bcd1c401e57ee71825d30c14
Parent:     caf0e8e028516253afce6e40c52f0c193a221f8a
Author:     Roel Kluin <roel.kluin at gmail.com>
AuthorDate: Wed Dec 16 01:37:17 2009 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Wed Dec 16 03:26:33 2009 +0000

    mtd: OneNAND: Fix test of unsigned in onenand_otp_walk()
    
    mtd->writesize and len are unsigned so the test does not work.
    
    Signed-off-by: Roel Kluin <roel.kluin at gmail.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/onenand/onenand_base.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 3330ea0..f63b1db 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -3165,10 +3165,10 @@ static int onenand_otp_walk(struct mtd_info *mtd, loff_t from, size_t len,
 
 	/* Check User/Factory boundary */
 	if (mode == MTD_OTP_USER) {
-		if (((mtd->writesize * otp_pages) - (from + len)) < 0)
+		if (mtd->writesize * otp_pages < from + len)
 			return 0;
 	} else {
-		if (((mtd->writesize * otp_pages) - len) < 0)
+		if (mtd->writesize * otp_pages <  len)
 			return 0;
 	}
 



More information about the linux-mtd-cvs mailing list