summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorEugene Teo <eteo@redhat.com>2007-05-19 11:09:20 +0800
committerJohn W. Linville <linville@tuxdriver.com>2007-05-22 11:02:29 -0400
commit596f2d0554352f1089f7478b309b27d8cdf5cd4f (patch)
treef901ca3688180b5405881fabd68f401ce457a247 /drivers/net
parent3d4bd24b019981394fabb465b0c7932924b83d65 (diff)
downloadlinux-stable-596f2d0554352f1089f7478b309b27d8cdf5cd4f.tar.gz
linux-stable-596f2d0554352f1089f7478b309b27d8cdf5cd4f.tar.bz2
linux-stable-596f2d0554352f1089f7478b309b27d8cdf5cd4f.zip
[PATCH] drivers/net/wireless/libertas/fw.c: fix use-before-check
NULL checks should be performed before the dereference. Spotted by the Coverity checker. Signed-off-by: Eugene Teo <eteo@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/libertas/fw.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
index 441123c85e62..5c63c9b1659c 100644
--- a/drivers/net/wireless/libertas/fw.c
+++ b/drivers/net/wireless/libertas/fw.c
@@ -333,18 +333,22 @@ static void command_timer_fn(unsigned long data)
unsigned long flags;
ptempnode = adapter->cur_cmd;
+ if (ptempnode == NULL) {
+ lbs_pr_debug(1, "PTempnode Empty\n");
+ return;
+ }
+
cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
+ if (!cmd) {
+ lbs_pr_debug(1, "cmd is NULL\n");
+ return;
+ }
lbs_pr_info("command_timer_fn fired (%x)\n", cmd->command);
if (!adapter->fw_ready)
return;
- if (ptempnode == NULL) {
- lbs_pr_debug(1, "PTempnode Empty\n");
- return;
- }
-
spin_lock_irqsave(&adapter->driver_lock, flags);
adapter->cur_cmd = NULL;
spin_unlock_irqrestore(&adapter->driver_lock, flags);