[Suggestion] drivers: staging: dgrp: dgrp_net_ops.c: 'buf' is used without initialized.

Chen Gang gang.chen.5i5j at gmail.com
Tue Dec 10 09:37:26 UTC 2013


On 12/10/2013 05:10 PM, Dan Carpenter wrote:
> On Tue, Dec 10, 2013 at 01:07:58PM +0800, Chen Gang wrote:
>> Hello Maintainers:
>>
>> The compiler help me find a warning about it, please help check thanks.
>>
>> The related git commit: "b73db54 Staging: dgrp: Refactor the function
>> dgrp_receive() in drrp_net_ops.c"
>>
> 
> There are a couple other wrong things with this patch as well.
> 
> 1) There should be a call to handle_data_in_packet() in case 9.
> 2) This code doesn't make sense:
> 
> +               dlen = plen - remain;
> +               b = buf;
> +
> +               b[0] = 0x90 + n1;
> +               put_unaligned_be16(dlen, b + 1);
> +
> +               remain = 3;
> +               if (remain > 0 && b != buf)
> 
> The first conditition is always true and the second condition is always
> false.
> 
> +                       memcpy(buf, b, remain);
> 

Yeah, for me, the code in handle_data_in_packet() needs re-construction
by related maintainers, it is not quite easy to improve these code by
other members.


Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water and life which God blessed


More information about the devel mailing list