From: Micah Gruber Date: Mon, 9 Jul 2007 03:29:04 +0000 (+0800) Subject: Fix a potential NULL pointer dereference in free_shared_mem() in drivers/net/s2io.c X-Git-Tag: v2.6.23-rc1~768^2~19 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8910b49fbb8d4517a20bb3de7dc239dcfa7d2b6f;p=linux-2.6 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 --- diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index fa29a403a2..7d54935581 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;