Skip to content

Commit

Permalink
staging: wlags49_h2: Replace kmalloc+memset by kzalloc and add error …
Browse files Browse the repository at this point in the history
…handling.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Santosh Nayak authored and Greg Kroah-Hartman committed Apr 10, 2012
1 parent 277ac73 commit 310c6a7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/staging/wlags49_h2/wl_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down

0 comments on commit 310c6a7

Please sign in to comment.