mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
brcmfmac: Only match complete feature names
The firmware advertises its features as a string of words separated by spaces. Ensure that feature names are only matched in their entirety. Signed-off-by: Phil Elwell <phil@raspberrypi.com>
This commit is contained in:
@@ -241,7 +241,14 @@ static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp)
|
||||
brcmf_dbg(INFO, "[ %s]\n", caps);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(brcmf_fwcap_map); i++) {
|
||||
if (strnstr(caps, brcmf_fwcap_map[i].fwcap_id, sizeof(caps))) {
|
||||
const char *match = strnstr(caps, brcmf_fwcap_map[i].fwcap_id, sizeof(caps));
|
||||
if (match) {
|
||||
char endc;
|
||||
if (match != caps && match[-1] != ' ')
|
||||
continue;
|
||||
endc = match[strlen(brcmf_fwcap_map[i].fwcap_id)];
|
||||
if (endc != '\0' && endc != ' ')
|
||||
continue;
|
||||
id = brcmf_fwcap_map[i].feature;
|
||||
brcmf_dbg(INFO, "enabling feature: %s\n",
|
||||
brcmf_feat_names[id]);
|
||||
|
||||
Reference in New Issue
Block a user