summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorYunfeng Ye <yeyunfeng@huawei.com>2019-09-29 12:44:17 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-06 13:08:30 +0100
commit13894f5b36090cc597e71fd6c6b6cdd4aaf3fdae (patch)
tree9b59d21024d812c5da2725b162d9137dcc65bc55 /arch
parentf839cea971ada1823fe88f439802aaf1e1dcfe84 (diff)
downloadlinux-stable-13894f5b36090cc597e71fd6c6b6cdd4aaf3fdae.tar.gz
linux-stable-13894f5b36090cc597e71fd6c6b6cdd4aaf3fdae.tar.bz2
linux-stable-13894f5b36090cc597e71fd6c6b6cdd4aaf3fdae.zip
arm64: armv8_deprecated: Checking return value for memory allocation
[ Upstream commit 3e7c93bd04edfb0cae7dad1215544c9350254b8f ] There are no return value checking when using kzalloc() and kcalloc() for memory allocation. so add it. Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com> Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm64/kernel/armv8_deprecated.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
index 2ec09debc2bb..ca158be21f83 100644
--- a/arch/arm64/kernel/armv8_deprecated.c
+++ b/arch/arm64/kernel/armv8_deprecated.c
@@ -174,6 +174,9 @@ static void __init register_insn_emulation(struct insn_emulation_ops *ops)
struct insn_emulation *insn;
insn = kzalloc(sizeof(*insn), GFP_KERNEL);
+ if (!insn)
+ return;
+
insn->ops = ops;
insn->min = INSN_UNDEF;
@@ -233,6 +236,8 @@ static void __init register_insn_emulation_sysctl(void)
insns_sysctl = kcalloc(nr_insn_emulated + 1, sizeof(*sysctl),
GFP_KERNEL);
+ if (!insns_sysctl)
+ return;
raw_spin_lock_irqsave(&insn_emulation_lock, flags);
list_for_each_entry(insn, &insn_emulation, node) {