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]

 



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