Bug 44061

Summary: core/sd.c:247: bad if test
Product: Drivers Reporter: David Binderman (dcb314)
Component: MMC/SDAssignee: Alan (alan)
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan, florian
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.5-rc5 Subsystem:
Regression: No Bisected commit-id:

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