[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220429162701.2222-11-srinivas.kandagatla@linaro.org>
Date: Fri, 29 Apr 2022 17:26:55 +0100
From: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To: gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org,
Dan Carpenter <dan.carpenter@...cle.com>,
Rafał Miłecki <rafal@...ecki.pl>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Subject: [PATCH 10/16] nvmem: brcm_nvram: check for allocation failure
From: Dan Carpenter <dan.carpenter@...cle.com>
Check for if the kcalloc() fails.
Fixes: 299dc152721f ("nvmem: brcm_nvram: parse NVRAM content into NVMEM cells")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
Acked-by: Rafał Miłecki <rafal@...ecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
---
drivers/nvmem/brcm_nvram.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/nvmem/brcm_nvram.c b/drivers/nvmem/brcm_nvram.c
index 450b927691c3..48bb8c62cbbf 100644
--- a/drivers/nvmem/brcm_nvram.c
+++ b/drivers/nvmem/brcm_nvram.c
@@ -97,6 +97,8 @@ static int brcm_nvram_parse(struct brcm_nvram *priv)
len = le32_to_cpu(header.len);
data = kcalloc(1, len, GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
memcpy_fromio(data, priv->base, len);
data[len - 1] = '\0';
--
2.21.0
Powered by blists - more mailing lists