Commit d19d8e3b authored by Hector Martin's avatar Hector Martin Committed by Kalle Valo

brcmfmac: firmware: Allocate space for default boardrev in nvram

If boardrev is missing from the NVRAM we add a default one, but this
might need more space in the output buffer than was allocated. Ensure
we have enough padding for this in the buffer.

Fixes: 46f2b38a ("brcmfmac: insert default boardrev in nvram data if missing")
Reviewed-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarHector Martin <marcan@marcan.st>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220131160713.245637-3-marcan@marcan.st
parent 5e90f0f3
...@@ -207,6 +207,8 @@ static int brcmf_init_nvram_parser(struct nvram_parser *nvp, ...@@ -207,6 +207,8 @@ static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
size = BRCMF_FW_MAX_NVRAM_SIZE; size = BRCMF_FW_MAX_NVRAM_SIZE;
else else
size = data_len; size = data_len;
/* Add space for properties we may add */
size += strlen(BRCMF_FW_DEFAULT_BOARDREV) + 1;
/* Alloc for extra 0 byte + roundup by 4 + length field */ /* Alloc for extra 0 byte + roundup by 4 + length field */
size += 1 + 3 + sizeof(u32); size += 1 + 3 + sizeof(u32);
nvp->nvram = kzalloc(size, GFP_KERNEL); nvp->nvram = kzalloc(size, GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment