]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
arm64: armv8_deprecated: Checking return value for memory allocation
authorYunfeng Ye <yeyunfeng@huawei.com>
Sun, 29 Sep 2019 04:44:17 +0000 (12:44 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 13 Nov 2019 23:47:34 +0000 (18:47 -0500)
BugLink: https://bugs.launchpad.net/bugs/1852492
[ 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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/arm64/kernel/armv8_deprecated.c

index c33b5e4010ab7660140025f9c17d6be10b66706d..99a90504d05aa48419c1dc32d1cca8d26d5e9723 100644 (file)
@@ -178,6 +178,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;
 
@@ -237,6 +240,8 @@ static void __init register_insn_emulation_sysctl(void)
 
        insns_sysctl = kzalloc(sizeof(*sysctl) * (nr_insn_emulated + 1),
                              GFP_KERNEL);
+       if (!insns_sysctl)
+               return;
 
        raw_spin_lock_irqsave(&insn_emulation_lock, flags);
        list_for_each_entry(insn, &insn_emulation, node) {