Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 279b4cb7 authored by Rafał Miłecki's avatar Rafał Miłecki Committed by Kalle Valo
Browse files

brcmfmac: treat \0 as end of comment when parsing NVRAM



This fixes brcmfmac dealing with NVRAM coming from platform e.g. from a
flash MTD partition. In such cases entries are separated by \0 instead
of \n which caused ignoring whole content after the first "comment".
While platform NVRAM doesn't usually contain comments, we switch to
COMMENT state after e.g. finding an unexpected char in key name.

Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 5d08408b
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -162,17 +162,20 @@ brcmf_nvram_handle_value(struct nvram_parser *nvp)
static enum nvram_parser_state
static enum nvram_parser_state
brcmf_nvram_handle_comment(struct nvram_parser *nvp)
brcmf_nvram_handle_comment(struct nvram_parser *nvp)
{
{
	char *eol, *sol;
	char *eoc, *sol;


	sol = (char *)&nvp->fwnv->data[nvp->pos];
	sol = (char *)&nvp->fwnv->data[nvp->pos];
	eol = strchr(sol, '\n');
	eoc = strchr(sol, '\n');
	if (eol == NULL)
	if (!eoc) {
		eoc = strchr(sol, '\0');
		if (!eoc)
			return END;
			return END;
	}


	/* eat all moving to next line */
	/* eat all moving to next line */
	nvp->line++;
	nvp->line++;
	nvp->column = 1;
	nvp->column = 1;
	nvp->pos += (eol - sol) + 1;
	nvp->pos += (eoc - sol) + 1;
	return IDLE;
	return IDLE;
}
}