nvmem: brcm_nvram: Add check for kzalloc
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Fri, 27 Jan 2023 10:40:06 +0000 (10:40 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 28 Jan 2023 13:36:28 +0000 (14:36 +0100)
commitb0576ade3aaf24b376ea1a4406ae138e2a22b0c0
tree50d23ff70fd5c0e5a1d29f9f61d037c0b774730f
parent2241ab53cbb5cdb08a6b2d4688feb13971058f65
nvmem: brcm_nvram: Add check for kzalloc

Add the check for the return value of kzalloc in order to avoid
NULL pointer dereference.

Fixes: 6e977eaa8280 ("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>
drivers/nvmem/brcm_nvram.c