lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 16 Dec 2009 01:37:17 +0100
From:	Roel Kluin <roel.kluin@...il.com>
To:	Kyungmin Park <kyungmin.park@...sung.com>,
	linux-mtd@...ts.infradead.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] 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@...il.com>
---
you can test this with:

#include <stdio.h>

int main()
{
        int c = 1, d = 1;
        unsigned a = 30;
        unsigned b = 10;

        if ((b * c) - (d + a) < 0)
                printf("good\n");
        else
                printf("bad\n");
        return 0;
}


diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index ff66e43..cbe2711 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -2725,7 +2725,7 @@ static int onenand_otp_walk(struct mtd_info *mtd, loff_t from, size_t len,
 	}
 
 	/* Check User/Factory boundary */
-	if (((mtd->writesize * otp_pages) - (from + len)) < 0)
+	if (mtd->writesize * otp_pages < from + len)
 		return 0;
 
 	onenand_get_device(mtd, FL_OTPING);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists