Re: [PATCH] nvmem: brcm_nvram: reject empty NVRAM partition

From: Srinivas Kandagatla

Date: Thu Jul 16 2026 - 17:24:05 EST



On Fri, 03 Jul 2026 15:28:30 -0700, Rosen Penev wrote:
> If the partition is completely erased (all padding bytes), the trimming
> loop reduces data_len to 0. devm_kzalloc(dev, 0, GFP_KERNEL) returns
> ZERO_SIZE_PTR ((void *)16), which is non-NULL and bypasses the NULL
> check. The subsequent cast of priv->data to struct brcm_nvram_header *
> and dereference of header->magic causes a page fault on address 0x10.
>
> Reject data_len smaller than the header before allocating.
>
> [...]

Applied, thanks!

[1/1] nvmem: brcm_nvram: reject empty NVRAM partition
commit: 5f75913830bc584dc6f43af8dca8de0dd910517e

Best regards,
--
Srinivas Kandagatla <srini@xxxxxxxxxx>