diff options
author | Micah Gruber <micah.gruber@gmail.com> | 2007-07-08 23:29:04 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-16 17:56:00 -0400 |
commit | 8910b49fbb8d4517a20bb3de7dc239dcfa7d2b6f (patch) | |
tree | c8ccd449c333a82cf8837df8275eec92d9986640 /drivers | |
parent | 4c75f7416f51b0c6855952467a5db04f9c598f09 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/s2io.c | 4 |
1 files changed, 3 insertions, 1 deletions
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) | |||
796 | struct mac_info *mac_control; | 796 | struct mac_info *mac_control; |
797 | struct config_param *config; | 797 | struct config_param *config; |
798 | int lst_size, lst_per_page; | 798 | int lst_size, lst_per_page; |
799 | struct net_device *dev = nic->dev; | 799 | struct net_device *dev; |
800 | int page_num = 0; | 800 | int page_num = 0; |
801 | 801 | ||
802 | if (!nic) | 802 | if (!nic) |
803 | return; | 803 | return; |
804 | 804 | ||
805 | dev = nic->dev; | ||
806 | |||
805 | mac_control = &nic->mac_control; | 807 | mac_control = &nic->mac_control; |
806 | config = &nic->config; | 808 | config = &nic->config; |
807 | 809 | ||