Bug 44061 - core/sd.c:247: bad if test
Summary: core/sd.c:247: bad if test
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: MMC/SD (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Alan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-01 14:26 UTC by David Binderman
Modified: 2012-08-04 19:10 UTC (History)
2 users (show)

See Also:
Kernel Version: 3.5-rc5
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description David Binderman 2012-07-01 14:26:50 UTC
I just ran the static analyser cppcheck over the source code of the
linux kernel version 3.5-rc5.

It said

[linux-3.5-rc5/drivers/mmc/core/sd.c:247]: (warning) Logical disjunction always evaluates to true: au > 0 || au <= 9.

The source code is

    if (au > 0 || au <= 9) {

I think you might be better off with

    if (au > 0 && au <= 9) {
Comment 1 Alan 2012-07-02 12:41:19 UTC
Patch queued
Comment 2 Florian Mickler 2012-08-04 19:10:43 UTC
A patch referencing this bug report has been merged in Linux v3.6-rc1:

commit b63b5e819d5b21ae493c17c356018ffa98d3ee1c
Author: Alan Cox <alan@linux.intel.com>
Date:   Mon Jul 2 18:55:13 2012 +0100

    mmc: core: correct invalid error checking

Note You need to log in before you can comment on or make changes to this bug.