From: Adrian Bunk <bunk@fs.tum.de>
To: dwmw2@redhat.com
Cc: mtd@infradead.org, linux-kernel@vger.kernel.org, trivial@rustcorp.com.au
Subject: [patch] mtd/ftl.c: remove always false comparison
Date: Wed, 30 Jul 2003 18:47:24 +0200 [thread overview]
Message-ID: <20030730164724.GA21734@fs.tum.de> (raw)
[resent with a subject]
gcc 3.3 correctly gives the following warning:
<-- snip -->
...
CC drivers/mtd/ftl.o
drivers/mtd/ftl.c: In function `scan_header':
drivers/mtd/ftl.c:191: warning: comparison is always false due to
limited range
...
<-- snip -->
Looking at the code it seems gcc is correct, a 16bit number can _never_
be > 65536.
The following patch removes this comparison:
--- linux-2.6.0-test2-full/drivers/mtd/ftl.c.old 2003-07-30 13:04:05.000000000 +0200
+++ linux-2.6.0-test2-full/drivers/mtd/ftl.c 2003-07-30 13:04:13.000000000 +0200
@@ -188,7 +188,7 @@
printk(KERN_NOTICE "ftl_cs: FTL header not found.\n");
return -ENOENT;
}
- if ((le16_to_cpu(header.NumEraseUnits) > 65536) || header.BlockSize != 9 ||
+ if (header.BlockSize != 9 ||
(header.EraseUnitSize < 10) || (header.EraseUnitSize > 31) ||
(header.NumTransferUnits >= le16_to_cpu(header.NumEraseUnits))) {
printk(KERN_NOTICE "ftl_cs: FTL header corrupt!\n");
I've tested the compilation with 2.6.0-test2 and 2.4.22-pre9.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
reply other threads:[~2003-07-30 16:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20030730164724.GA21734@fs.tum.de \
--to=bunk@fs.tum.de \
--cc=dwmw2@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mtd@infradead.org \
--cc=trivial@rustcorp.com.au \
/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
all inboxes | Powered by JetHome®