2013-11-05 15:02:32

by David Binderman

[permalink] [raw]
Subject: bluez-5.10/monitor/packet.c:4335: possible missing break ?

Hello there,

I just ran the static analysis checker "cppcheck" over the source code of bluez-5.10

It said

[monitor/packet.c:4335] -> [monitor/packet.c:4338]: (warning) Variable 'str' is reassigned a value
?before the old one has been used. 'break;' missing?

Source code is

??? case 0x03:
??????? str = "Allow Scan Request from White List Only, "
??????????? "Allow Connect Request from White List Only";
??? default:
??????? str = "Reserved";
??????? break;

Suggest add a break statement to the 0x03 case.

Regards

David Binderman


2013-11-06 08:15:23

by Johan Hedberg

[permalink] [raw]
Subject: Re: bluez-5.10/monitor/packet.c:4335: possible missing break ?

Hi David,

On Tue, Nov 05, 2013, David Binderman wrote:
> Hello there,
>
> I just ran the static analysis checker "cppcheck" over the source code of bluez-5.10
>
> It said
>
> [monitor/packet.c:4335] -> [monitor/packet.c:4338]: (warning) Variable 'str' is reassigned a value
> ?before the old one has been used. 'break;' missing?
>
> Source code is
>
> ??? case 0x03:
> ??????? str = "Allow Scan Request from White List Only, "
> ??????????? "Allow Connect Request from White List Only";
> ??? default:
> ??????? str = "Reserved";
> ??????? break;
>
> Suggest add a break statement to the 0x03 case.

Yes, that looks like a bug. Do you want to send a proper patch for it?

Johan