mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 05:27:07 +02:00
nvmem: brcm_nvram: Add check for kzalloc
commitb0576ade3aupstream. Add the check for the return value of kzalloc in order to avoid NULL pointer dereference. Fixes:6e977eaa82("nvmem: brcm_nvram: parse NVRAM content into NVMEM cells") Cc: stable@vger.kernel.org Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20230127104015.23839-2-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4092267ad6
commit
f5249bbae0
|
|
@ -97,6 +97,9 @@ static int brcm_nvram_parse(struct brcm_nvram *priv)
|
|||
len = le32_to_cpu(header.len);
|
||||
|
||||
data = kzalloc(len, GFP_KERNEL);
|
||||
if (!data)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy_fromio(data, priv->base, len);
|
||||
data[len - 1] = '\0';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user