]> git.baikalelectronics.ru Git - kernel.git/commit
mt76: fix wcid allocation issues
authorFelix Fietkau <nbd@nbd.name>
Sat, 23 May 2020 12:40:57 +0000 (14:40 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 28 May 2020 15:57:24 +0000 (17:57 +0200)
commit03230bf0d52649cd8bdbbf4a9f97a1e45e7b8b2e
tree84772c3bb9f269d3912b33baeb621e5c1fe925de
parenteebe8de15b743d57af22abbbb1277941fb901d03
mt76: fix wcid allocation issues

mt76 core uses ffs() to find the next free bit. This works well for 32 bit
architectures where BITS_PER_LONG is 32. ffs only checks 32 bit values, so
allocation fails on 64 bit architectures.
Additionally, the wcid mask array was too small in cases where the array
was not a multiple of BITS_PER_LONG.
Fix this by making the wcid mask array u32 instead and use DIV_ROUND_UP
for the size, just in case we ever bump it to a value that's not a multiple
of 32.

Reported-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76.h
drivers/net/wireless/mediatek/mt76/util.c
drivers/net/wireless/mediatek/mt76/util.h