From 8910b49fbb8d4517a20bb3de7dc239dcfa7d2b6f Mon Sep 17 00:00:00 2001 From: Micah Gruber Date: Mon, 9 Jul 2007 11:29:04 +0800 Subject: [PATCH] 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 --- drivers/net/s2io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index fa29a403a247..7d549355815a 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c @@ -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;