Bug 76741 - lib/lockdep/preload.c:95: possible bad test ?
Summary: lib/lockdep/preload.c:95: possible bad test ?
Status: RESOLVED CODE_FIX
Alias: None
Product: Tools
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Tools.Other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-22 16:15 UTC by David Binderman
Modified: 2015-02-19 07:07 UTC (History)
3 users (show)

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


Attachments

Description David Binderman 2014-05-22 16:15:29 UTC
[linux-3.15-rc5/tools/lib/lockdep/preload.c:95]: (warning) Comparison of a boolean expression with an integer other than 0 or 1.

Source code is

enum { none, prepare, done, } __init_state;
static void init_preload(void);
static void try_init_preload(void)
{
    if (!__init_state != done)
        init_preload();
}

Confusing double negative.

Comparison of a boolean value (!__init_state) with a value of 2 (done)
is unlikely to succeed.

Suggest code rework.
Comment 1 Andrey Utkin 2014-07-07 11:28:58 UTC
Looking at behaviour of init_preload(), which returns early if __init_state == done, i think that try_init_preload() can be dropped and replaced with just init_preload() where it was used.
Comment 2 Jaime Arrocha 2014-10-20 19:40:22 UTC
This has been fixed on the latest release of the kernel or as of 3.17.0.

The function was changed to,

static void try_init_preload(void)
{
	if (__init_state != done)
		init_preload();
}

I am new in this forum. How do I know if this kind of bugs have been fixed? Checking the mailing list archives?
Comment 3 Jean Delvare 2014-10-23 13:29:48 UTC
Bugzilla is a bug tracker, not a forum.

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