Bug 46921

Summary: gdm72xx/gdm_sdio.c:683: bad pointer test
Product: Drivers Reporter: David Binderman (dcb314)
Component: StagingAssignee: Alan (alan)
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan, florian
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.6-rc4 Subsystem:
Regression: No Bisected commit-id:

Description David Binderman 2012-09-02 16:47:14 UTC
I just ran the static analyser cppcheck over the source code of the
linux kernel version 3.6-rc4.

It said

[linux-3.6-rc4/drivers/staging/gdm72xx/gdm_sdio.c:683]: (style) A pointer can not be negative so it is either pointless or an error to check if it is.

The source code is

    ret = init_sdio(sdev);
    if (sdev < 0)
        goto out;


Suggest new code

    ret = init_sdio(sdev);
    if (ret < 0)
        goto out;
Comment 1 Greg Kroah-Hartman 2012-09-02 23:32:10 UTC
On Sun, Sep 02, 2012 at 04:47:14PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=46921
> 
>            Summary: gdm72xx/gdm_sdio.c:683: bad pointer test

Please post patches or this info to the mailing list.

greg k-h
Comment 2 Alan 2012-09-03 15:43:04 UTC
Patch queued
Comment 3 Florian Mickler 2012-10-15 21:22:42 UTC
A patch referencing this bug report has been merged in Linux v3.7-rc1:

commit f1efd9fe08a9ada843cd99f949a130555df045bd
Author: Alan Cox <alan@linux.intel.com>
Date:   Tue Sep 4 16:04:36 2012 +0100

    staging: gdm72xx: Fix bogus test