|SUCCESS| [v3] net/ark: fix null dereference on allocation failure
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Thu Jun 4 02:03:47 CEST 2026
Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/164904
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-06-04
git sha: bf73ee28f47b ("net/ark: support single function with multiple port")
Author: Denis Sergeev <denserg.edu at gmail.com>
Subject: [PATCH v3] net/ark: fix null dereference on allocation failure
This patch adds a NULL check after rte_zmalloc_socket() to prevent
undefined behavior when memory allocation fails.
> diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
> index 8b25ed948f..546a44704f 100644
> --- a/drivers/net/ark/ark_ethdev.c
> +++ b/drivers/net/ark/ark_ethdev.c
> @@ -445,6 +445,10 @@ ark_dev_init(struct rte_eth_dev *dev)
> sizeof(struct ark_adapter),
> RTE_CACHE_LINE_SIZE,
> rte_socket_id());
> + if (eth_dev->data->dev_private == NULL) {
> + ARK_PMD_LOG(ERR, "Memory allocation for dev_private failed\n");
> + goto error;
> + }
Does this error path properly clean up resources allocated earlier in
ark_dev_init()? Looking at the function flow, if dev_private allocation
fails here, does the error label handle cleanup for resources like
ark->bar0 mappings, or the ark structure itself that was allocated
before this point?
Also, the ARK_PMD_LOG() macro should not have \n in the format string
if it already appends a newline (as is common in DPDK logging macros).
Does ARK_PMD_LOG add its own newline?
>
> memcpy(eth_dev->data->dev_private, ark,
> sizeof(struct ark_adapter));
More information about the test-report
mailing list