]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
[PATCH] drivers/net/wireless/libertas/fw.c: fix use-before-check
authorEugene Teo <eteo@redhat.com>
Sat, 19 May 2007 03:09:20 +0000 (11:09 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 22 May 2007 15:02:29 +0000 (11:02 -0400)
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>
drivers/net/wireless/libertas/fw.c

index 441123c85e62ce0a3d68ec0f0db26414966683a3..5c63c9b1659c1e45e1054bb01fd0969a82dfa563 100644 (file)
@@ -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);