summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2018-03-29 00:06:10 +0200
committerSeung-Woo Kim <sw0312.kim@samsung.com>2019-12-30 15:44:33 +0900
commitc129abd2b698b4a86be19d24953c7eb005895b2f (patch)
tree3b9f0220c8933cf1fd799612292e9768a95e06db
parentd949ccaf68479697f896a4c9462b4e5ff54d802d (diff)
downloadlinux-artik7-c129abd2b698b4a86be19d24953c7eb005895b2f.tar.gz
linux-artik7-c129abd2b698b4a86be19d24953c7eb005895b2f.tar.bz2
linux-artik7-c129abd2b698b4a86be19d24953c7eb005895b2f.zip
ath10k: avoid possible string overflow
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> [sw0312.kim: cherry-pick from stable linux-4.4.y commit a1402232e193 for gcc 9 build] Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Change-Id: Idd3506f5ee90d7ff4811294d8590478a28d5ea1e
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index f201e50447d8..b867875aa6e6 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4065,7 +4065,7 @@ static void ath10k_tpc_config_disp_tables(struct ath10k *ar,
rate_code[i],
type);
snprintf(buff, sizeof(buff), "%8d ", tpc[j]);
- strncat(tpc_value, buff, strlen(buff));
+ strlcat(tpc_value, buff, sizeof(tpc_value));
}
tpc_stats->tpc_table[type].pream_idx[i] = pream_idx;
tpc_stats->tpc_table[type].rate_code[i] = rate_code[i];