[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220402083436.2413189-1-lv.ruyi@zte.com.cn>
Date: Sat, 2 Apr 2022 08:34:36 +0000
From: cgel.zte@...il.com
To: rth@...ddle.net
Cc: ink@...assic.park.msu.ru, mattst88@...il.com, lv.ruyi@....com.cn,
linux-alpha@...r.kernel.org, linux-kernel@...r.kernel.org,
Zeal Robot <zealci@....com.cn>
Subject: [PATCH] alpha: add null pointer check
From: Lv Ruyi <lv.ruyi@....com.cn>
kmalloc is a memory allocation function which can return NULL when some
internal memory errors happen. Add null pointer check to avoid
dereferencing null pointer.
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@....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