[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20221103011645.138749-1-liaochang1@huawei.com>
Date: Thu, 3 Nov 2022 09:16:45 +0800
From: Liao Chang <liaochang1@...wei.com>
To: <linux@...linux.org.uk>, <liaochang1@...wei.com>,
<nico@...xnic.net>, <tixy@...t.co.uk>
CC: <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2] ARM: kprobes: Improve robustness for kprobe coverage testing
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@...wei.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
Powered by blists - more mailing lists