staging: rtl8192u: check dev_alloc_skb() return value in fw_download_code()

This patch adds a check whether skb allocation, in fw_download_code(), was
successful.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Xenia Ragiadakou 2013-09-21 23:42:26 +03:00 committed by Greg Kroah-Hartman
parent ccb0ec8338
commit f8518efa4e

View File

@ -62,6 +62,8 @@ bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buff
* add 4 to avoid packet appending overflow. * add 4 to avoid packet appending overflow.
* */ * */
skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + frag_length + 4); skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + frag_length + 4);
if (!skb)
return false;
memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
tcb_desc->queue_index = TXCMD_QUEUE; tcb_desc->queue_index = TXCMD_QUEUE;