Messages in this thread Patch in this message | | | From | Liao Chang <> | Subject | [PATCH 1/2] ARM: kprobes: Improve robustness for kprobe coverage testing | Date | Thu, 3 Nov 2022 09:16:45 +0800 |
| |
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
| |