]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Staging: rtl8192su: check for skb == NULL
authorFlorian Schilhabel <florian.c.schilhabel@googlemail.com>
Tue, 4 May 2010 12:23:43 +0000 (14:23 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 9 May 2011 22:55:08 +0000 (15:55 -0700)
commit 199ef62a287b429a8fa3b7dc5ae6b69f607bf324 upstream.

added 2 checks for skb == NULL.
plus cosmetics

Signed-off-by: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
[bwh: Remove cosmetic changes]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rtl8192su/r8192S_firmware.c
drivers/staging/rtl8192su/r819xU_cmdpkt.c

index 3561adf0468a8a7823f11394e8cd6939604e4346..62306615f509d9c0a3bb08c00b3313fb611b7fb0 100644 (file)
@@ -68,6 +68,11 @@ bool FirmwareDownloadCode(struct net_device *dev, u8 *       code_virtual_address,u32
 
                /* Allocate skb buffer to contain firmware info and tx descriptor info. */
                skb  = dev_alloc_skb(frag_length);
+               if (skb == NULL) {
+                       RT_TRACE(COMP_ERR, "(%s): unable to alloc skb buffer\n",
+                                                               __func__);
+                       goto cmdsend_downloadcode_fail;
+               }
                memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
 
                tcb_desc = (cb_desc*)(skb->cb + MAX_DEV_ADDR_SIZE);
index e2ba93e307578c4507daec1f816fc2cbc56d6f7b..071b5c60ac282a6c57838bbf15b0393f063a1e9e 100644 (file)
@@ -56,6 +56,12 @@ SendTxCommandPacket(
 
        //Get TCB and local buffer from common pool. (It is shared by CmdQ, MgntQ, and USB coalesce DataQ)
        skb  = dev_alloc_skb(USB_HWDESC_HEADER_LEN + DataLen + 4);
+       if (skb == NULL) {
+               RT_TRACE(COMP_ERR, "(%s): unable to alloc skb buffer\n",
+                                                               __func__);
+               rtStatus = false;
+               return rtStatus;
+       }
        memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
        tcb_desc = (cb_desc*)(skb->cb + MAX_DEV_ADDR_SIZE);
        tcb_desc->queue_index = TXCMD_QUEUE;