Re: [PATCH v4] staging: wlags49_h2: strncpy, need checking the memory length

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

 



On Wed, May 15, 2013 at 10:51:58AM +0800, Chen Gang wrote:
> 
> HCF_MAX_NAME_LEN is 32, which may less than ''probe_rsp->rawData[1]'',
> so need check the length when copy to ssid.
> 
> Type of 'probe_rsp->rawData[1]' is 'hcf_8' which is 'unsigned char',
> it will compare with 'int', so use min_t() to cast to 'int' to avoid
> related warning.
> 
> If use min(), it has '(void) (&_min1 == &_min2);', so if no type cast,
> the compiler will report 'pointer types lacks a cast':
> 
>   drivers/staging/wlags49_h2/wl_main.c:3174:122: warning: comparison of distinct pointer types lacks a cast [enabled by default]
> 
> 
> 
> Signed-off-by: root <root@xxxxxxxxxxxxxxxxxxx>
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Oops.

Of course, I wish you had used min_t(u8, for the reasons I described
before but int also works fine.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/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