aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-05-23 09:15:33 +0200
committerKalle Valo <kvalo@codeaurora.org>2015-05-28 11:53:04 +0300
commitfc23e81eb8f4231aa8a34c83e95c11d72e494f1d (patch)
treee5f1f3499bc0588349d4731f260efa1b97be91e8
parentbrcmfmac: treat \0 as end of comment when parsing NVRAM (diff)
downloadlinux-dev-fc23e81eb8f4231aa8a34c83e95c11d72e494f1d.tar.xz
linux-dev-fc23e81eb8f4231aa8a34c83e95c11d72e494f1d.zip
brcmfmac: allow NVRAM values to contain spaces
Platform NVRAMs often contain values with spaces. Even if right now most firmware-supported entries are simple values, we shouldn't reject these with spaces. It was semi-confirmed by Broadcom in the early patch adding support for platform NVRAMs. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/firmware.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
index e6673a9b6e9e..7ae6461df932 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
@@ -66,6 +66,12 @@ struct nvram_parser {
bool multi_dev_v2;
};
+/**
+ * is_nvram_char() - check if char is a valid one for NVRAM entry
+ *
+ * It accepts all printable ASCII chars except for '#' which opens a comment.
+ * Please note that ' ' (space) while accepted is not a valid key name char.
+ */
static bool is_nvram_char(char c)
{
/* comment marker excluded */
@@ -73,7 +79,7 @@ static bool is_nvram_char(char c)
return false;
/* key and value may have any other readable character */
- return (c > 0x20 && c < 0x7f);
+ return (c >= 0x20 && c < 0x7f);
}
static bool is_whitespace(char c)
@@ -120,7 +126,7 @@ static enum nvram_parser_state brcmf_nvram_handle_key(struct nvram_parser *nvp)
nvp->multi_dev_v1 = true;
if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
nvp->multi_dev_v2 = true;
- } else if (!is_nvram_char(c)) {
+ } else if (!is_nvram_char(c) || c == ' ') {
brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
nvp->line, nvp->column);
return COMMENT;