Skip to content

Commit

Permalink
Fix a potential NULL pointer dereference in free_shared_mem() in driv…
Browse files Browse the repository at this point in the history
…ers/net/s2io.c

This patch fixes a potential null dereference bug where we dereference
nic before a null check. This patch simply moves the dereferencing
after the null check.

Signed-off-by: Micah Gruber < micah.gruber@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Micah Gruber authored and Jeff Garzik committed Jul 16, 2007
1 parent 4c75f74 commit 8910b49
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/s2io.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,12 +796,14 @@ static void free_shared_mem(struct s2io_nic *nic)
struct mac_info *mac_control;
struct config_param *config;
int lst_size, lst_per_page;
struct net_device *dev = nic->dev;
struct net_device *dev;
int page_num = 0;

if (!nic)
return;

dev = nic->dev;

mac_control = &nic->mac_control;
config = &nic->config;

Expand Down

0 comments on commit 8910b49

Please sign in to comment.