diff options
author | Andre Renaud <andre@bluewatersys.com> | 2007-04-17 13:50:59 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2007-04-17 13:50:59 -0400 |
commit | 4226b510371efd9cdc628663527d36aee36054a9 (patch) | |
tree | 061cab08eb3a95d3036d780895c1cc88972d8e7a /drivers/mtd/nand | |
parent | 340ea370c2ce89d1c15fbf785460f2f74314ce58 (diff) |
[MTD] [NAND] Casting bug in nand_default_block_markbad
There is a slight bug in nand_default_block_markbad, where the offset is
cast to an integer, prior to being shifted. This means that on large
offsets, it is incorrectly doing a signed shift & losing bits. Fixed
this by doing the cast after the shift (as is done elsewhere in the code).
Signed-off-by: Andre Renaud <andre@bluewatersys.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 5b96f1c5759f..ab3b2d16cffe 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -350,7 +350,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) | |||
350 | int block, ret; | 350 | int block, ret; |
351 | 351 | ||
352 | /* Get block number */ | 352 | /* Get block number */ |
353 | block = ((int)ofs) >> chip->bbt_erase_shift; | 353 | block = (int)(ofs >> chip->bbt_erase_shift); |
354 | if (chip->bbt) | 354 | if (chip->bbt) |
355 | chip->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1); | 355 | chip->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1); |
356 | 356 | ||