[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202301171823476416320@zte.com.cn>
Date: Tue, 17 Jan 2023 18:23:47 +0800 (CST)
From: <ye.xingchen@....com.cn>
To: <richard.henderson@...aro.org>
Cc: <ink@...assic.park.msu.ru>, <mattst88@...il.com>,
<linux-alpha@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<chi.minghao@....com.cn>
Subject: [PATCH] alpha: potential dereference of null pointer
From: Minghao Chi <chi.minghao@....com.cn>
The return value of kmalloc() 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/alpha/kernel/module.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c
index 5b60c248de9e..5442b75a98c2 100644
--- a/arch/alpha/kernel/module.c
+++ b/arch/alpha/kernel/module.c
@@ -47,6 +47,8 @@ process_reloc_for_got(Elf64_Rela *rela,
}
g = kmalloc (sizeof (*g), GFP_KERNEL);
+ if (!g)
+ return;
g->next = chains[r_sym].next;
g->r_addend = r_addend;
g->got_offset = *poffset;
--
2.25.1
Powered by blists - more mailing lists