lkml.org 
[lkml]   [2022]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] ARM: kprobes: Improve robustness for kprobe coverage testing
Date
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(+)

diff --git a/arch/arm/probes/kprobes/test-core.c b/arch/arm/probes/kprobes/test-core.c
index c562832b8627..e6a932e863bb 100644
--- a/arch/arm/probes/kprobes/test-core.c
+++ b/arch/arm/probes/kprobes/test-core.c
@@ -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);
--
2.17.1
\
 
 \ /
  Last update: 2022-11-03 02:21    [W:0.023 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site