Project

General

Profile

Actions

Bug #3023

closed

sys/dev/netif/bwn/bwn/if_bwn.c: 2 * strange bitmasks ?

Added by dcb over 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Driver
Target version:
-
Start date:
04/11/2017
Due date:
% Done:

0%

Estimated time:

Description

1.

sys/dev/netif/bwn/bwn/if_bwn.c:2646]: (error) Shifting 64-bit value by 64 bits is undefined behaviour

Source code is

return (BWN_DMA_BIT_MASK(64));

Bitmasks are conventionally numbered 0 .. 63.

2.

sys/dev/netif/bwn/bwn/if_bwn.c:2664]: (error) Shifting 64-bit value by 64 bits is undefined behaviour

Source code is

if (dmamask == BWN_DMA_BIT_MASK(64))
Actions #1

Updated by lubos about 7 years ago

  • Category set to Driver

I think this is actually a false positive, look at the definition of BWN_DMA_BIT_MASK:

#define BWN_DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))

It wouldn't shift by 64 bits.

--

Lubos Boucek

Actions #2

Updated by swildner about 7 years ago

  • Status changed from New to Closed

Yes, the n == 64 case is explicitly caught. Maybe something to report to cppcheck devs.

Actions

Also available in: Atom PDF