[1/2] ARM: kprobes: Improve robustness for kprobe coverage testing
Commit Message
Improve robustness for kprobe coverage testing, avoid to access NULL
pointer in coverage_start_fn.
Fixes: 963780dfe390 ("ARM: kprobes: Add decoding table test coverage analysis")
Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
arch/arm/probes/kprobes/test-core.c | 5 +++++
1 file changed, 5 insertions(+)
@@ -766,6 +766,11 @@ static int coverage_start(const union decode_item *table)
coverage.base = kmalloc_array(MAX_COVERAGE_ENTRIES,
sizeof(struct coverage_entry),
GFP_KERNEL);
+ if (!coverage.base) {
+ pr_err("FAIL: Out of space for allocating coverage entries");
+ return -ENOMEM;
+ }
+
coverage.num_entries = 0;
coverage.nesting = 0;
return table_iter(table, coverage_start_fn, &coverage);