ar5523: Don't dereference sta if NULL
authorPontus Fuchs <pontus.fuchs@gmail.com>
Mon, 5 Nov 2012 20:17:51 +0000 (21:17 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 14 Nov 2012 19:55:41 +0000 (14:55 -0500)
A missing else caused a potential NULL dereference.

Reported-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ar5523/ar5523.c

index 4bd7714cd66aebe9c1e82667d8776dd28083860b..7157f7d311c5e001a2e071231d50755fc7a9c3cb 100644 (file)
@@ -1196,8 +1196,8 @@ static void ar5523_create_rateset(struct ar5523 *ar,
        if (!sta) {
                ar5523_info(ar, "STA not found. Cannot set rates\n");
                sta_rate_set = bss_conf->basic_rates;
-       }
-       sta_rate_set = sta->supp_rates[ar->hw->conf.channel->band];
+       } else
+               sta_rate_set = sta->supp_rates[ar->hw->conf.channel->band];
 
        ar5523_dbg(ar, "sta rate_set = %08x\n", sta_rate_set);