Commit 0a032a4d authored by Roel Kluin's avatar Roel Kluin Committed by David Woodhouse
Browse files

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: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent caf0e8e0
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -3165,10 +3165,10 @@ static int onenand_otp_walk(struct mtd_info *mtd, loff_t from, size_t len,


	/* Check User/Factory boundary */
	/* Check User/Factory boundary */
	if (mode == MTD_OTP_USER) {
	if (mode == MTD_OTP_USER) {
		if (((mtd->writesize * otp_pages) - (from + len)) < 0)
		if (mtd->writesize * otp_pages < from + len)
			return 0;
			return 0;
	} else {
	} else {
		if (((mtd->writesize * otp_pages) - len) < 0)
		if (mtd->writesize * otp_pages <  len)
			return 0;
			return 0;
	}
	}