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

Rashika Kheria rashika.kheria at gmail.com
Tue Dec 10 09:57:55 UTC 2013


Hello all,

I tried to refactor this function.

On Tue, Dec 10, 2013 at 3:07 PM, Chen Gang <gang.chen.5i5j at gmail.com> wrote:
> 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.

I checked this part of the code and agree that a call to
handle_data_in_packet() must be present in case 9. Sorry for
previously overlooking it.

>> 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);
>>

I will check for this part of the code.

>
> 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.
>
>

Should I attempt to rectify the code in handle_data_in_packet() ?


Thanks and regards,
-- 
Rashika Kheria
B.Tech CSE
IIIT Hyderabad


More information about the devel mailing list