kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: Check for Null return of allocated skb in fw_download_code
@ 2014-08-13  3:12 Nicholas Krause
  2014-08-13  3:14 ` Nick Krause
  0 siblings, 1 reply; 21+ messages in thread
From: Nicholas Krause @ 2014-08-13  3:12 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] staging: Check for Null return of allocated skb in fw_download_code
@ 2014-08-13  3:24 Nicholas Krause
  2014-08-13  3:31 ` Nick Krause
  2014-08-13  5:35 ` Valdis.Kletnieks at vt.edu
  0 siblings, 2 replies; 21+ messages in thread
From: Nicholas Krause @ 2014-08-13  3:24 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2014-08-13 19:52 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-13  3:12 [PATCH] staging: Check for Null return of allocated skb in fw_download_code Nicholas Krause
2014-08-13  3:14 ` 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

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).