Re: [PATCH] USB CDC NCM: Don't deref NULL in cdc_ncm_rx_fixup() and don't use uninitialized variable.

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

 



From: Jesper Juhl <jj@xxxxxxxxxxxxx>
Date: Thu, 13 Jan 2011 22:40:11 +0100 (CET)

> skb_clone() dynamically allocates memory and may fail. If it does it 
> returns NULL. This means we'll dereference a NULL pointer in 
> drivers/net/usb/cdc_ncm.c::cdc_ncm_rx_fixup().
> As far as I can tell, the proper way to deal with this is simply to goto 
> the error label.
> 
> Furthermore gcc complains that 'skb' may be used uninitialized:
>   drivers/net/usb/cdc_ncm.c: In function ʽcdc_ncm_rx_fixupʼ:
>   drivers/net/usb/cdc_ncm.c:922:18: warning: ʽskbʼ may be used uninitialized in this function
> and I believe it is right. On the line where we
>   pr_debug("invalid frame detected (ignored)" ...
> we are using the local variable 'skb' but nothing has ever been assigned 
> to that variable yet. I believe the correct fix for that is to use 
> 'skb_in' instead.
> 
> Signed-off-by: Jesper Juhl <jj@xxxxxxxxxxxxx>

Applied.
?τθΊ{.nΗ+?·???­?+%?Λ?±ιέΆ??w?Ί{.nΗ+?·??{±ώλώ)ν?ζθw*jg¬±¨Ά????έʼj?Ύ«ώG«?ι?ʼΈʼ·¦j:+v?¨?wθjΨmΆ??ώψ―ω?w?ώ?ΰώf£ʼ·h??β?ϊ??Ω?



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux