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 01:17 PM, Greg KH 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"
>>
>> The related warning (with allmodconfig for metag):
>>
>>     CC [M]  drivers/staging/dgrp/dgrp_net_ops.o
>>   drivers/staging/dgrp/dgrp_net_ops.c: In function 'handle_data_in_packet':
>>   drivers/staging/dgrp/dgrp_net_ops.c:2392: warning: 'buf' is used uninitialized in this function
> 
> Great, care to send a patch to fix this?
> 

Excuse me, I am not quite familiar with this driver details, after
reading the related code, I am still confusing (don't know what it
wants to do):


2390         if (remain < plen) {
2391                 dlen = plen - remain;
2392                 b = buf;				/* buf is uninitialized */
2393 
2394                 b[0] = 0x90 + n1;
2395                 put_unaligned_be16(dlen, b + 1);
2396 
2397                 remain = 3;
2398                 if (remain > 0 && b != buf)      /* 'remain' always > 0, 'b' always == 'buf' */
2399                         memcpy(buf, b, remain);  /* 'buf' is a stack pointer, will be lost after return from handel_data_in_packet() */
2400 
2401                 nd->nd_remain = remain;
2402                 return;
2403         }

Does it want to save the left information in a buffer which need be
still existent after return from handle_data_in_packet()?


And also welcome any members help send related patch for it.

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