Fix a potential NULL pointer dereference in free_shared_mem() in drivers/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>
This commit is contained in:
Micah Gruber 2007-07-09 11:29:04 +08:00 committed by Jeff Garzik
parent 4c75f7416f
commit 8910b49fbb

View File

@ -796,12 +796,14 @@ static void free_shared_mem(struct s2io_nic *nic)
struct mac_info *mac_control; struct mac_info *mac_control;
struct config_param *config; struct config_param *config;
int lst_size, lst_per_page; int lst_size, lst_per_page;
struct net_device *dev = nic->dev; struct net_device *dev;
int page_num = 0; int page_num = 0;
if (!nic) if (!nic)
return; return;
dev = nic->dev;
mac_control = &nic->mac_control; mac_control = &nic->mac_control;
config = &nic->config; config = &nic->config;