1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
2 Date: Sat, 23 May 2015 09:15:33 +0200
3 Subject: [PATCH] brcmfmac: allow NVRAM values to contain spaces
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
8 Platform NVRAMs often contain values with spaces. Even if right now most
9 firmware-supported entries are simple values, we shouldn't reject these
10 with spaces. It was semi-confirmed by Broadcom in the early patch adding
11 support for platform NVRAMs.
13 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
14 Acked-by: Arend van Spriel <arend@broadcom.com>
15 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
18 --- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
19 +++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
20 @@ -66,6 +66,12 @@ struct nvram_parser {
25 + * is_nvram_char() - check if char is a valid one for NVRAM entry
27 + * It accepts all printable ASCII chars except for '#' which opens a comment.
28 + * Please note that ' ' (space) while accepted is not a valid key name char.
30 static bool is_nvram_char(char c)
32 /* comment marker excluded */
33 @@ -73,7 +79,7 @@ static bool is_nvram_char(char c)
36 /* key and value may have any other readable character */
37 - return (c > 0x20 && c < 0x7f);
38 + return (c >= 0x20 && c < 0x7f);
41 static bool is_whitespace(char c)
42 @@ -120,7 +126,7 @@ static enum nvram_parser_state brcmf_nvr
43 nvp->multi_dev_v1 = true;
44 if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
45 nvp->multi_dev_v2 = true;
46 - } else if (!is_nvram_char(c)) {
47 + } else if (!is_nvram_char(c) || c == ' ') {
48 brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
49 nvp->line, nvp->column);