]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ath10k: avoid possible string overflow
authorArnd Bergmann <arnd@arndb.de>
Wed, 28 Mar 2018 22:06:10 +0000 (00:06 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit9370efd1fc7ff8ac184c68ae6ded52be687d4e61
tree39b280388200660e02a5dce8f1feb20a01d52387
parent4d5c0302d098826322fec0335528ecf8341e88f9
ath10k: avoid possible string overflow

BugLink: https://bugs.launchpad.net/bugs/1838116
commit 6707ba0105a2d350710bc0a537a98f49eb4b895d upstream.

The way that 'strncat' is used here raised a warning in gcc-8:

drivers/net/wireless/ath/ath10k/wmi.c: In function 'ath10k_wmi_tpc_stats_final_disp_tables':
drivers/net/wireless/ath/ath10k/wmi.c:4649:4: error: 'strncat' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]

Effectively, this is simply a strcat() but the use of strncat() suggests
some form of overflow check. Regardless of whether this might actually
overflow, using strlcat() instead of strncat() avoids the warning and
makes the code more robust.

Fixes: bc64d05220f3 ("ath10k: debugfs support to get final TPC stats for 10.4 variants")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/wireless/ath/ath10k/wmi.c