diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2018-11-07 12:02:43 +0100 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2018-11-07 12:09:54 +0100 |
commit | 5195136002fe3a53676cfef38aaa923b7014aca2 (patch) | |
tree | 2bf433bd439c8aeba25c062eed121b15ad9818f6 /package/kernel/mac80211/patches/344-v4.20-0001-brcmfmac-fix-wrong-strnchr-usage.patch | |
parent | 156f6e63c4d9583b1e31bf623574c683376b9e6a (diff) | |
download | upstream-5195136002fe3a53676cfef38aaa923b7014aca2.tar.gz upstream-5195136002fe3a53676cfef38aaa923b7014aca2.tar.bz2 upstream-5195136002fe3a53676cfef38aaa923b7014aca2.zip |
mac80211: brcmfmac: rename 4.20 backport patches
Include kernel version to help tracking changes.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit f7a3459ab9c4d8f5102c8ae0861ca481571703f7)
Diffstat (limited to 'package/kernel/mac80211/patches/344-v4.20-0001-brcmfmac-fix-wrong-strnchr-usage.patch')
-rw-r--r-- | package/kernel/mac80211/patches/344-v4.20-0001-brcmfmac-fix-wrong-strnchr-usage.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/344-v4.20-0001-brcmfmac-fix-wrong-strnchr-usage.patch b/package/kernel/mac80211/patches/344-v4.20-0001-brcmfmac-fix-wrong-strnchr-usage.patch new file mode 100644 index 0000000000..8267b37864 --- /dev/null +++ b/package/kernel/mac80211/patches/344-v4.20-0001-brcmfmac-fix-wrong-strnchr-usage.patch @@ -0,0 +1,38 @@ +From cb18e2e9ec71d42409a51b83546686c609780dde Mon Sep 17 00:00:00 2001 +From: Rasmus Villemoes <linux@rasmusvillemoes.dk> +Date: Wed, 22 Aug 2018 15:22:15 +0200 +Subject: [PATCH] brcmfmac: fix wrong strnchr usage + +strnchr takes arguments in the order of its name: string, max bytes to +read, character to search for. Here we're passing '\n' aka 10 as the +buffer size, and searching for sizeof(buf) aka BRCMF_DCMD_SMLEN aka +256 (aka '\0', since it's implicitly converted to char) within those 10 +bytes. + +Just interchanging the last two arguments would still leave a bug, +because if we've been successful once, there are not sizeof(buf) +characters left after the new value of p. + +Since clmver is immediately afterwards passed as a %s argument, I assume +that it is actually a properly nul-terminated string. For that case, we +have strreplace(). + +Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> +Signed-off-by: Kalle Valo <kvalo@codeaurora.org> +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -296,9 +296,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + /* Replace all newline/linefeed characters with space + * character + */ +- ptr = clmver; +- while ((ptr = strnchr(ptr, '\n', sizeof(buf))) != NULL) +- *ptr = ' '; ++ strreplace(clmver, '\n', ' '); + + brcmf_dbg(INFO, "CLM version = %s\n", clmver); + } |