From: Andre Renaud <andre@bluewatersys.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] [MTD] Casting bug in nand_default_block_markbad
Date: Wed, 11 Apr 2007 15:14:24 +1200 [thread overview]
Message-ID: <461C5290.6090202@bluewatersys.com> (raw)
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>
Index: drivers/mtd/nand/nand_base.c
===================================================================
--- drivers/mtd/nand/nand_base.c (revision 957)
+++ drivers/mtd/nand/nand_base.c (working copy)
@@ -355,7 +355,7 @@
int block, ret;
/* Get block number */
- block = ((int)ofs) >> chip->bbt_erase_shift;
+ block = (int)(ofs >> chip->bbt_erase_shift);
if (chip->bbt)
chip->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1);
--
Bluewater Systems Ltd - ARM Technology Solutions Centre
Andre Renaud Bluewater Systems Ltd
Phone: +64 3 3779127 (Aus 1 800 148 751) Level 17, 119 Armagh St
Fax: +64 3 3779135 PO Box 13889
Email: arenaud@bluewatersys.com Christchurch
Web: http://www.bluewatersys.com New Zealand
next reply other threads:[~2007-04-11 3:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-11 3:14 Andre Renaud [this message]
2007-04-14 9:56 ` [PATCH] [MTD] Casting bug in nand_default_block_markbad Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=461C5290.6090202@bluewatersys.com \
--to=andre@bluewatersys.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox