Thread (37 messages) 37 messages, 4 authors, 2022-01-20

Re: [PATCH v3 2/9] brcmfmac: firmware: Allocate space for default boardrev in nvram

From: Hector Martin <hidden>
Date: 2022-01-20 06:08:50
Also in: linux-acpi, linux-wireless, lkml, netdev

On 20/01/2022 06.35, Andy Shevchenko wrote:
On Mon, Jan 17, 2022 at 4:30 PM Hector Martin [off-list ref] wrote:
quoted
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.
Do you know this ahead (before allocation happens)?
If yes, the size change should happen conditionally.

Alternatively, krealloc() may be used.
We don't know if we will have to add a boardrev until we find it's
missing. The buffer is already oversized anyway, as its size is computed
based on the input NVRAM size, while comments and such will be removed.
This is just increasing the existing worst-case allocation to properly
account for the true worst-case case.

I don't think trying to keep the buffer perfectly sized buys us anything
here, since it will be freed after download anyway. There's no point in
saving a few bytes of memory in the interim.

-- 
Hector Martin (marcan@marcan.st)
Public Key: https://mrcn.st/pub
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help