• Kees Cook's avatar
    wifi: mwifiex: Refactor 1-element array into flexible array in struct... · 14ddc470
    Kees Cook authored
    wifi: mwifiex: Refactor 1-element array into flexible array in struct mwifiex_ie_types_chan_list_param_set
    
    struct mwifiex_ie_types_chan_list_param_set::chan_scan_param is treated
    as a flexible array, so convert it into one so that it doesn't trip
    the array bounds sanitizer[1]. Only a few places were using sizeof()
    on the whole struct, so adjust those to follow the calculation pattern
    to avoid including the trailing single element.
    
    Examining binary output differences doesn't appear to show any literal
    size values changing, though it is obfuscated a bit by the compiler
    adjusting register usage and stack spill slots, etc.
    
    Link: https://github.com/KSPP/linux/issues/51 [1]
    Cc: Brian Norris <briannorris@chromium.org>
    Cc: Kalle Valo <kvalo@kernel.org>
    Cc: Dmitry Antipov <dmantipov@yandex.ru>
    Cc: Johannes Berg <johannes.berg@intel.com>
    Cc: zuoqilin <zuoqilin@yulong.com>
    Cc: Ruan Jinjie <ruanjinjie@huawei.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
    Cc: linux-wireless@vger.kernel.org
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    Reviewed-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
    Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
    Link: https://msgid.link/20240207103024.make.423-kees@kernel.org
    14ddc470
11n.c 25.8 KB