diff mbox series

[v4,9/9] net/cnxk: fix telemetry possible null pointer access

Message ID 20220513025357.52275-10-fengchengwen@huawei.com (mailing list archive)
State Accepted
Delegated to: Andrew Rybchenko
Headers show
Series bugfix for ethdev telemetry | expand


Context Check Description
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

fengchengwen May 13, 2022, 2:53 a.m. UTC
The return value of rte_tel_data_alloc() may be null pointer, in this
patch, the null check function is added.

Fixes: 5ea354a1f2cc ("net/cnxk: support telemetry")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
 drivers/net/cnxk/cnxk_ethdev_telemetry.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series


diff --git a/drivers/net/cnxk/cnxk_ethdev_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_telemetry.c
index 83bc65848c..4fd9048643 100644
--- a/drivers/net/cnxk/cnxk_ethdev_telemetry.c
+++ b/drivers/net/cnxk/cnxk_ethdev_telemetry.c
@@ -49,6 +49,8 @@  ethdev_tel_handle_info(const char *cmd __rte_unused,
 	rte_tel_data_add_dict_int(d, "n_ports", n_ports);
 	i_data = rte_tel_data_alloc();
+	if (i_data == NULL)
+		return -ENOMEM;
 	rte_tel_data_start_array(i_data, RTE_TEL_U64_VAL);
 	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {