]> git.baikalelectronics.ru Git - kernel.git/commit
ath10k: avoid possible string overflow
authorArnd Bergmann <arnd@arndb.de>
Wed, 28 Mar 2018 22:06:10 +0000 (00:06 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 10 Apr 2018 14:27:52 +0000 (17:27 +0300)
commitb01985bf9fabd989c9ebd3d77b18797c86f10353
treefeec6f72ea84977c1e707a5f2bd170fc2a215e96
parent2c044049bba50cb994154e07e36b26d023c3d726
ath10k: avoid possible string overflow

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: 34aa7e6918ba ("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>
drivers/net/wireless/ath/ath10k/wmi.c