From: "Rafał Miłecki" <zajec5@gmail.com>
To: Kalle Valo <kvalo@codeaurora.org>, linux-wireless@vger.kernel.org
Cc: "Brett Rudley" <brudley@broadcom.com>,
"Arend van Spriel" <arend@broadcom.com>,
"Franky (Zhenhui) Lin" <frankyl@broadcom.com>,
"Hante Meuleman" <meuleman@broadcom.com>,
brcm80211-dev-list@broadcom.com,
"Rafał Miłecki" <zajec5@gmail.com>
Subject: [PATCH V4] brcmfmac: allow NVRAM values to contain spaces
Date: Sat, 23 May 2015 09:15:33 +0200 [thread overview]
Message-ID: <1432365333-1074-1-git-send-email-zajec5@gmail.com> (raw)
In-Reply-To: <1432331128-24011-1-git-send-email-zajec5@gmail.com>
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>
---
V2: Minor change in commit message only. Provide an example of NVRAM entry
using space (not just a '#'). It's unprefixed (shouldn't be uploaded to
hardware anyway), but proves it's allowed in general.
V3: As commented by Arend, accept space only (not a '#').
V4: Fix typo in "Broadcom" in commit message
---
drivers/net/wireless/brcm80211/brcmfmac/firmware.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
index 45d7191..baad939 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;
--
1.8.4.5
next prev parent reply other threads:[~2015-05-23 7:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 18:10 [PATCH] brcmfmac: allow NVRAM values to contain space and '#' chars Rafał Miłecki
2015-05-20 18:15 ` [PATCH V2] " Rafał Miłecki
2015-05-22 21:45 ` [PATCH V3] brcmfmac: allow NVRAM values to contain spaces Rafał Miłecki
2015-05-23 6:47 ` Arend van Spriel
2015-05-23 7:15 ` Rafał Miłecki [this message]
2015-05-28 8:53 ` [PATCH V4] " Kalle Valo
2015-05-22 9:14 ` [PATCH] brcmfmac: allow NVRAM values to contain space and '#' chars Arend van Spriel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432365333-1074-1-git-send-email-zajec5@gmail.com \
--to=zajec5@gmail.com \
--cc=arend@broadcom.com \
--cc=brcm80211-dev-list@broadcom.com \
--cc=brudley@broadcom.com \
--cc=frankyl@broadcom.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=meuleman@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).