mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
wil6210: fix wil_cid_valid with negative cid values
There are several occasions where a negative cid value is passed into wil_cid_valid and this is converted into a u8 causing the range check of cid >= 0 to always succeed. Fix this by making the cid argument an int to handle any -ve error value of cid. An example of this behaviour is in wil_cfg80211_dump_station, where cid is assigned -ENOENT if the call to wil_find_cid_by_idx fails, and this -ve value is passed to wil_cid_valid. I believe that the conversion of -ENOENT to the u8 value 254 which is greater than wil->max_assoc_sta causes wil_find_cid_by_idx to currently work fine, but I think is by luck and not the intended behaviour. Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Maya Erez <merez@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
67538eb5c0
commit
23bb9f692b
1 changed files with 1 additions and 1 deletions
|
|
@ -1144,7 +1144,7 @@ static inline void wil_c(struct wil6210_priv *wil, u32 reg, u32 val)
|
|||
/**
|
||||
* wil_cid_valid - check cid is valid
|
||||
*/
|
||||
static inline bool wil_cid_valid(struct wil6210_priv *wil, u8 cid)
|
||||
static inline bool wil_cid_valid(struct wil6210_priv *wil, int cid)
|
||||
{
|
||||
return (cid >= 0 && cid < wil->max_assoc_sta);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue