public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [patch 2.6.28-rc5] mtd m25p80: regression fix for chip detection
@ 2008-11-17 19:37 David Brownell
  0 siblings, 0 replies; only message in thread
From: David Brownell @ 2008-11-17 19:37 UTC (permalink / raw)
  To: Linux MTD; +Cc: Chen Gong, lkml

From: David Brownell <dbrownell@users.sourceforge.net>

The "m25p80.c extended jedec support" patch introduced a regression
whereby every chip ended up matching the first entry in the list
of chips, since it parenthesized a test incorrectly.

This bug could cause MTD filesystem corruption, and all sorts crazy
stuff since all chips would appear to be small (128KB) Atmel chips
instead of what they really were.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Chen Gong <g.chen@freescale.com>
---
 drivers/mtd/devices/m25p80.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -574,10 +574,11 @@ static struct flash_info *__devinit jede
 	for (tmp = 0, info = m25p_data;
 			tmp < ARRAY_SIZE(m25p_data);
 			tmp++, info++) {
-		if (info->jedec_id == jedec)
+		if (info->jedec_id == jedec) {
 			if (ext_jedec != 0 && info->ext_id != ext_jedec)
 				continue;
 			return info;
+		}
 	}
 	dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec);
 	return NULL;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-17 21:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-17 19:37 [patch 2.6.28-rc5] mtd m25p80: regression fix for chip detection David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox