From: Santosh Nayak Date: Fri, 23 Mar 2012 15:44:02 +0000 (+0530) Subject: staging: wlags49_h2: Replace kmalloc+memset by kzalloc and add error handling. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=310c6a762e224ae38efac304c936b82ad89a4ff1;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git staging: wlags49_h2: Replace kmalloc+memset by kzalloc and add error handling. Replace kmalloc+memset pair by kzalloc() in 'wl_wds_device_alloc()'. Add error handling to avoid null derefernce. Signed-off-by: Santosh Nayak Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/wlags49_h2/wl_netdev.c b/drivers/staging/wlags49_h2/wl_netdev.c index 90820ff1aced..6a44cb87bdf6 100644 --- a/drivers/staging/wlags49_h2/wl_netdev.c +++ b/drivers/staging/wlags49_h2/wl_netdev.c @@ -1510,8 +1510,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 );