Skip to content

Commit

Permalink
arm64: armv8_deprecated: Checking return value for memory allocation
Browse files Browse the repository at this point in the history
There are no return value checking when using kzalloc() and kcalloc() for
memory allocation. so add it.

Signed-off-by: Yunfeng Ye <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
  • Loading branch information
yeyunfeng-dev authored and willdeacon committed Oct 8, 2019
1 parent 7c4791c commit 3e7c93b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/arm64/kernel/armv8_deprecated.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 3e7c93b

Please sign in to comment.