[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202301171822040406304@zte.com.cn>
Date: Tue, 17 Jan 2023 18:22:04 +0800 (CST)
From: <ye.xingchen@....com.cn>
To: <andrew@...n.ch>
Cc: <gregory.clement@...tlin.com>, <sebastian.hesselbarth@...il.com>,
<linux@...linux.org.uk>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <chi.minghao@....com.cn>
Subject: [PATCH] ARM: mvebu: potential dereference of null pointer
From: Minghao Chi <chi.minghao@....com.cn>
The return value of kzalloc() needs to be checked.
To avoid use of null pointer in case of the failure of alloc.
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Minghao Chi <chi.minghao@....com.cn>
Signed-off-by: ye xingchen <ye.xingchen@....com.cn>
---
arch/arm/mach-mvebu/board-v7.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c
index fd5d0c8ff695..b93b4a8a8357 100644
--- a/arch/arm/mach-mvebu/board-v7.c
+++ b/arch/arm/mach-mvebu/board-v7.c
@@ -125,7 +125,8 @@ static void __init i2c_quirk(void)
struct property *new_compat;
new_compat = kzalloc(sizeof(*new_compat), GFP_KERNEL);
-
+ if (!new_compat)
+ return;
new_compat->name = kstrdup("compatible", GFP_KERNEL);
new_compat->length = sizeof("marvell,mv78230-a0-i2c");
new_compat->value = kstrdup("marvell,mv78230-a0-i2c",
--
2.25.1
Powered by blists - more mailing lists