Commit c9a61469 authored by Stefan Agner's avatar Stefan Agner Committed by Kalle Valo

brcmsmac: fix wrap around in conversion from constant to s16

The last value in the log_table wraps around to a negative value
since s16 has a value range of -32768 to 32767. This is not what
the table intends to represent. Use the closest positive value
32767.

This fixes a warning seen with clang:
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_qmath.c:216:2: warning:
      implicit conversion from 'int' to 's16' (aka 'short') changes
value from 32768
      to -32768 [-Wconstant-conversion]
        32768
        ^~~~~
1 warning generated.

Fixes: 4c0bfeaa ("brcmsmac: fix array out-of-bounds access in qm_log10")
Cc: Tobias Regnery <tobias.regnery@gmail.com>
Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent eb5d2f3a
......@@ -213,7 +213,7 @@ static const s16 log_table[] = {
30498,
31267,
32024,
32768
32767
};
#define LOG_TABLE_SIZE 32 /* log_table size */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment