kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: xerofoify@gmail.com (Nicholas Krause)
To: kernelnewbies@lists.kernelnewbies.org
Subject: [PATCH] staging: Check for Null return of allocated skb in fw_download_code
Date: Tue, 12 Aug 2014 23:12:58 -0400	[thread overview]
Message-ID: <1407899578-19730-1-git-send-email-xerofoify@gmail.com> (raw)

This patch checks if we are getting a Null allocated skb in the while/do
loop of this function. Further more no reference checking is needing
as skb_put is only working with the packet defined by skb and not allocating
a new one. Further more I am breaking out of the loop in order to make sure
we call nic_write_byte and cause no errors with writing the nic byte(s) of
private date and then call rt_status which I changed to false in the loop
with my additon of checking the allocated skb.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
index 1a95d1f..829af66 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
@@ -61,6 +61,10 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
 		}
 
 		skb  = dev_alloc_skb(frag_length + 4);
+		if( skb == NULL) {
+			rt_status =  false ;
+			break;
+		}	
 		memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev));
 		tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
 		tcb_desc->queue_index = TXCMD_QUEUE;
-- 
1.9.1

             reply	other threads:[~2014-08-13  3:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13  3:12 Nicholas Krause [this message]
2014-08-13  3:14 ` [PATCH] staging: Check for Null return of allocated skb in fw_download_code Nick Krause
  -- strict thread matches above, loose matches on Subject: below --
2014-08-13  3:24 Nicholas Krause
2014-08-13  3:31 ` Nick Krause
2014-08-13  5:35 ` Valdis.Kletnieks at vt.edu
2014-08-13  5:53   ` Manish Katiyar
2014-08-13 13:56     ` Valdis.Kletnieks at vt.edu
2014-08-13 14:50       ` Max Filippov
2014-08-13 16:02         ` Valdis.Kletnieks at vt.edu
2014-08-13 16:55           ` Nick Krause
2014-08-13 18:03             ` Nick Krause
2014-08-13 18:09               ` Philipp Muhoray
2014-08-13 18:11               ` Max Filippov
2014-08-13 18:25                 ` Jerry Snitselaar
2014-08-13 18:27                   ` Nick Krause
2014-08-13 18:58                     ` Nick Krause
2014-08-13 18:20               ` Jeff Haran
2014-08-13 19:17               ` Valdis.Kletnieks at vt.edu
2014-08-13 19:24                 ` Nick Krause
2014-08-13 19:52                   ` Nick Krause
2014-08-13 19:06             ` Valdis.Kletnieks at vt.edu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407899578-19730-1-git-send-email-xerofoify@gmail.com \
    --to=xerofoify@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).