[MTD] [NOR] Fix overflow check in jedec_probe

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Dec 3 08:59:02 EST 2007


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=f6f0f81895ad8272905bf3d637b7c99a62238d79
Commit:     f6f0f81895ad8272905bf3d637b7c99a62238d79
Parent:     5d3cce3b8ef45317c59487f4d83dc43c355ae40a
Author:     David Woodhouse <dwmw2 at infradead.org>
AuthorDate: Fri Nov 30 16:24:52 2007 +0000
Committer:  David Woodhouse <dwmw2 at infradead.org>
CommitDate: Mon Dec 3 12:49:38 2007 +0000

    [MTD] [NOR] Fix overflow check in jedec_probe
    
    Having laid the code out so that it's easier to read instead of sticking
    to the 80-column guideline even when it doesn't make sense, a bug is
    immediately spotted... we were only checking _one_ of the unlock
    addresses to see if it runs off the end of the map.
    
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mtd/chips/jedec_probe.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c
index cb8c34d..6041ce8 100644
--- a/drivers/mtd/chips/jedec_probe.c
+++ b/drivers/mtd/chips/jedec_probe.c
@@ -1952,7 +1952,7 @@ static int jedec_probe_chip(struct map_info *map, __u32 base,
 	}
 	/* Ensure the unlock addresses we try stay inside the map */
 	probe_offset1 = cfi_build_cmd_addr(cfi->addr_unlock1, cfi_interleave(cfi), cfi->device_type);
-	probe_offset2 = cfi_build_cmd_addr(cfi->addr_unlock1, cfi_interleave(cfi), cfi->device_type);
+	probe_offset2 = cfi_build_cmd_addr(cfi->addr_unlock2, cfi_interleave(cfi), cfi->device_type);
 	if (	((base + probe_offset1 + map_bankwidth(map)) >= map->size) ||
 		((base + probe_offset2 + map_bankwidth(map)) >= map->size))
 		goto retry;



More information about the linux-mtd-cvs mailing list