diff options
author | Eugene Teo <eteo@redhat.com> | 2007-05-18 23:09:20 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-05-22 11:02:29 -0400 |
commit | 596f2d0554352f1089f7478b309b27d8cdf5cd4f (patch) | |
tree | f901ca3688180b5405881fabd68f401ce457a247 /drivers/net/wireless | |
parent | 3d4bd24b019981394fabb465b0c7932924b83d65 (diff) |
[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/wireless')
-rw-r--r-- | drivers/net/wireless/libertas/fw.c | 14 |
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) | |||
333 | unsigned long flags; | 333 | unsigned long flags; |
334 | 334 | ||
335 | ptempnode = adapter->cur_cmd; | 335 | ptempnode = adapter->cur_cmd; |
336 | if (ptempnode == NULL) { | ||
337 | lbs_pr_debug(1, "PTempnode Empty\n"); | ||
338 | return; | ||
339 | } | ||
340 | |||
336 | cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr; | 341 | cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr; |
342 | if (!cmd) { | ||
343 | lbs_pr_debug(1, "cmd is NULL\n"); | ||
344 | return; | ||
345 | } | ||
337 | 346 | ||
338 | lbs_pr_info("command_timer_fn fired (%x)\n", cmd->command); | 347 | lbs_pr_info("command_timer_fn fired (%x)\n", cmd->command); |
339 | 348 | ||
340 | if (!adapter->fw_ready) | 349 | if (!adapter->fw_ready) |
341 | return; | 350 | return; |
342 | 351 | ||
343 | if (ptempnode == NULL) { | ||
344 | lbs_pr_debug(1, "PTempnode Empty\n"); | ||
345 | return; | ||
346 | } | ||
347 | |||
348 | spin_lock_irqsave(&adapter->driver_lock, flags); | 352 | spin_lock_irqsave(&adapter->driver_lock, flags); |
349 | adapter->cur_cmd = NULL; | 353 | adapter->cur_cmd = NULL; |
350 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 354 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |