*new* check_test_bit: check for test_bit(BIT(0), &foo)
commit1efa5fbe8e6617081a7e48be71a7fa7f077d6c05
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 13 May 2015 13:13:38 +0000 (13 16:13 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Wed, 13 May 2015 13:13:38 +0000 (13 16:13 +0300)
treeef0951de4f0410059a29acb34c3500364ae81b37
parent183362897b9c795d502f7022c034a29ad1914b4f
*new* check_test_bit: check for test_bit(BIT(0), &foo)

Joe Perches found a bug like this:

if (test_bit((QL_RESET_PER_SCSI | QL_RESET_START), &qdev->flags)) {

Where the intent was clearly:

if (test_bit(QL_RESET_PER_SCSI, &qdev->flags) ||
    test_bit(QL_RESET_START, &qdev->flags)) {

I didn't find any similar instances of that, but quite few places do:

if (test_bit(BIT(0), &map)) {

instead of:

if (test_bit(0, &map)) {

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
check_list.h
check_test_bit.c [new file with mode: 0644]