* [PATCH 1/2] test/hash: check memory allocation
[not found] <20251030175329.4041960-1-thomas@monjalon.net>
@ 2025-10-30 17:50 ` Thomas Monjalon
2025-10-31 7:51 ` David Marchand
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Monjalon @ 2025-10-30 17:50 UTC (permalink / raw)
To: dev
Cc: david.marchand, stable, Yipeng Wang, Sameh Gobriel,
Bruce Richardson, Vladimir Medvedkin
When reserving a specific memory amount, it was possible to pass
the first allocations and fail on a later allocation
where there was no check, resulting in a crash.
It is fixed by stopping the test if allocation failed.
Fixes: fd368e1982bc ("test/hash: test more corner cases")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test/test_hash_readwrite.c | 5 +++++
app/test/test_hash_readwrite_lf_perf.c | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/app/test/test_hash_readwrite.c b/app/test/test_hash_readwrite.c
index 82fe03cc5a..22ccd6df6a 100644
--- a/app/test/test_hash_readwrite.c
+++ b/app/test/test_hash_readwrite.c
@@ -70,6 +70,11 @@ test_hash_readwrite_worker(__rte_unused void *arg)
ret = rte_malloc(NULL, sizeof(int) *
tbl_rw_test_param.num_insert, 0);
+ if (ret == NULL) {
+ printf("allocation failed\n");
+ return -1;
+ }
+
for (i = 0; i < rte_lcore_count(); i++) {
if (worker_core_ids[i] == lcore_id)
break;
diff --git a/app/test/test_hash_readwrite_lf_perf.c b/app/test/test_hash_readwrite_lf_perf.c
index 864c3059d9..bef987d29d 100644
--- a/app/test/test_hash_readwrite_lf_perf.c
+++ b/app/test/test_hash_readwrite_lf_perf.c
@@ -1310,6 +1310,10 @@ test_hash_rcu_qsbr_writer_perf(struct rwc_perf *rwc_perf_results, int rwc_lf,
sz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE);
rv = (struct rte_rcu_qsbr *)rte_zmalloc(NULL, sz, RTE_CACHE_LINE_SIZE);
+ if (rv == NULL) {
+ printf("allocation failed\n");
+ goto err;
+ }
rcu_config.v = rv;
if (rte_hash_rcu_qsbr_add(tbl_rwc_test_param.h, &rcu_config) < 0) {
--
2.51.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] test/hash: check memory allocation
2025-10-30 17:50 ` [PATCH 1/2] test/hash: check memory allocation Thomas Monjalon
@ 2025-10-31 7:51 ` David Marchand
0 siblings, 0 replies; 2+ messages in thread
From: David Marchand @ 2025-10-31 7:51 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, stable, Yipeng Wang, Sameh Gobriel, Bruce Richardson,
Vladimir Medvedkin
On Thu, 30 Oct 2025 at 18:53, Thomas Monjalon <thomas@monjalon.net> wrote:
>
> When reserving a specific memory amount, it was possible to pass
> the first allocations and fail on a later allocation
> where there was no check, resulting in a crash.
> It is fixed by stopping the test if allocation failed.
>
> Fixes: fd368e1982bc ("test/hash: test more corner cases")
Also
Fixes: 9c7d8eed1a45 ("test/hash: add RCU tests")
> Cc: stable@dpdk.org
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Marchand <david.marchand@redhat.com>
--
David Marchand
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-31 7:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20251030175329.4041960-1-thomas@monjalon.net>
2025-10-30 17:50 ` [PATCH 1/2] test/hash: check memory allocation Thomas Monjalon
2025-10-31 7:51 ` David Marchand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).