On 05/14/2013 10:44 PM, Greg Kroah-Hartman wrote:
> On Tue, May 14, 2013 at 04:33:38PM +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',
>> > better to cast to 'int' to avoid related warning.
>> > 
>> > For compiling, 'min()' is defined in include/linux/kernel.h, 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: Chen Gang <[email protected]>
>> > ---
>> >  drivers/staging/wlags49_h2/wl_main.c |    3 ++-
>> >  1 files changed, 2 insertions(+), 1 deletions(-)
>> > 
>> > diff --git a/drivers/staging/wlags49_h2/wl_main.c 
>> > b/drivers/staging/wlags49_h2/wl_main.c
>> > index f28f15b..2e089dc 100644
>> > --- a/drivers/staging/wlags49_h2/wl_main.c
>> > +++ b/drivers/staging/wlags49_h2/wl_main.c
>> > @@ -3171,7 +3171,8 @@ void wl_process_mailbox( struct wl_private *lp )
>> >  
>> >                                    memset( ssid, 0, sizeof( ssid ));
>> >                                    strncpy( ssid, &probe_rsp->rawData[2],
>> > -                                                   probe_rsp->rawData[1] 
>> > );
>> > +                                           min((int)probe_rsp->rawData[1],
>> > +                                                  HCF_MAX_NAME_LEN - 1));
> If you ever find yourself casting a type in a min() call, use the
> min_t() call instead.
> 

OK, thanks.

> Care to try again?

Yes, I should try.


Thanks.
-- 
Chen Gang

Asianux Corporation
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to