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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

I tried to refactor this function.

On Tue, Dec 10, 2013 at 3:07 PM, Chen Gang <gang.chen.5i5j@xxxxxxxxx> 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
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux