All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: wlags49_h2: Replace kmalloc+memset by kzalloc and add error handling.
@ 2012-03-23 15:56 santosh nayak
  0 siblings, 0 replies; only message in thread
From: santosh nayak @ 2012-03-23 15:56 UTC (permalink / raw)
  To: kernel-janitors

From: Santosh Nayak <santoshprasadnayak@gmail.com>

Replace kmalloc+memset pair by kzalloc() in 'wl_wds_device_alloc()'.
Add error handling to avoid null derefernce.

Signed-off-by: Santosh Nayak <santoshprasadnayak@gmail.com>
---
 drivers/staging/wlags49_h2/wl_netdev.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wlags49_h2/wl_netdev.c b/drivers/staging/wlags49_h2/wl_netdev.c
index 9c16f54..b41b572 100644
--- a/drivers/staging/wlags49_h2/wl_netdev.c
+++ b/drivers/staging/wlags49_h2/wl_netdev.c
@@ -1511,8 +1511,11 @@ void wl_wds_device_alloc( struct wl_private *lp )
     for( count = 0; count < NUM_WDS_PORTS; count++ ) {
         struct net_device *dev_wds = NULL;
 
-        dev_wds = kmalloc( sizeof( struct net_device ), GFP_KERNEL );
-        memset( dev_wds, 0, sizeof( struct net_device ));
+	dev_wds = kzalloc(sizeof(struct net_device), GFP_KERNEL);
+	if (!dev_wds) {
+		DBG_LEAVE(DbgInfo);
+		return;
+	}
 
         ether_setup( dev_wds );
 
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-23 15:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23 15:56 [PATCH v2] staging: wlags49_h2: Replace kmalloc+memset by kzalloc and add error handling santosh nayak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.