Commit 310c6a76 authored by Santosh Nayak's avatar Santosh Nayak Committed by Greg Kroah-Hartman

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: default avatarSantosh Nayak <santoshprasadnayak@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 277ac737
...@@ -1510,8 +1510,11 @@ void wl_wds_device_alloc( struct wl_private *lp ) ...@@ -1510,8 +1510,11 @@ void wl_wds_device_alloc( struct wl_private *lp )
for( count = 0; count < NUM_WDS_PORTS; count++ ) { for( count = 0; count < NUM_WDS_PORTS; count++ ) {
struct net_device *dev_wds = NULL; struct net_device *dev_wds = NULL;
dev_wds = kmalloc( sizeof( struct net_device ), GFP_KERNEL ); dev_wds = kzalloc(sizeof(struct net_device), GFP_KERNEL);
memset( dev_wds, 0, sizeof( struct net_device )); if (!dev_wds) {
DBG_LEAVE(DbgInfo);
return;
}
ether_setup( dev_wds ); ether_setup( dev_wds );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment