ath6kl: fix fw capability parsing
[cascardo/linux.git] / drivers / net / wireless / ath / ath6kl / init.c
index 62e25cc..f90b5db 100644 (file)
@@ -1004,9 +1004,6 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
                                   ar->hw.reserved_ram_size);
                        break;
                case ATH6KL_FW_IE_CAPABILITIES:
-                       if (ie_len < DIV_ROUND_UP(ATH6KL_FW_CAPABILITY_MAX, 8))
-                               break;
-
                        ath6kl_dbg(ATH6KL_DBG_BOOT,
                                   "found firmware capabilities ie (%zd B)\n",
                                   ie_len);
@@ -1015,6 +1012,9 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
                                index = i / 8;
                                bit = i % 8;
 
+                               if (index == ie_len)
+                                       break;
+
                                if (data[index] & (1 << bit))
                                        __set_bit(i, ar->fw_capabilities);
                        }