Bug 44151 - cpqphp_ctrl.c: 2 * bad if test
Summary: cpqphp_ctrl.c: 2 * bad if test
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: HotPlug (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Greg Kroah-Hartman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-02 20:44 UTC by David Binderman
Modified: 2012-10-23 18:30 UTC (History)
2 users (show)

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


Attachments

Description David Binderman 2012-07-02 20:44:33 UTC
I just ran the static analyser cppcheck over the source code of the
linux kernel version 3.5-rc5.

It said

1.

[linux-3.5-rc5/drivers/pci/hotplug/cpqphp_ctrl.c:2893]: (style) Expression '(X & 0xb) == 0x4' is always false

The source code is

                } else if ((temp_register & 0x0BL) == 0x04) {

Clearly broken code. I am not sure what the fix is.

2.

[linux-3.5-rc5/drivers/pci/hotplug/cpqphp_ctrl.c:2909]: (style) Expression '(X & 0xb) == 0x6' is always false

The source code is

                } else if ((temp_register & 0x0BL) == 0x06) {

Duplicate.
Comment 1 Alan 2012-08-29 14:34:44 UTC
It will always take the 0x00 path instead of the 0x04 or 0x06 paths. This appears harmless.
Comment 2 Florian Mickler 2012-10-15 21:24:31 UTC
A patch referencing this bug report has been merged in Linux v3.7-rc1:

commit b161dabc3d3004ea56a8d20b0f5ec9bf68e67180
Author: Alan Cox <alan@linux.intel.com>
Date:   Tue Sep 4 15:39:57 2012 +0100

    PCI: cpqphp: Remove unreachable path

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