[PATCH v2 1/5] eal: check lcore variable handle
David Marchand
david.marchand at redhat.com
Tue Dec 17 09:59:48 CET 2024
Add an assert to double check the passed handle is not NULL, as it
points at an initialisation/allocation issue prior to accessing this
lcore variable.
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
lib/eal/include/rte_lcore_var.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/eal/include/rte_lcore_var.h b/lib/eal/include/rte_lcore_var.h
index 0216a67cab..ca31dff6fd 100644
--- a/lib/eal/include/rte_lcore_var.h
+++ b/lib/eal/include/rte_lcore_var.h
@@ -24,6 +24,7 @@
#include <rte_common.h>
#include <rte_config.h>
+#include <rte_debug.h>
#include <rte_lcore.h>
#ifdef __cplusplus
@@ -125,6 +126,7 @@ extern "C" {
static inline void *
rte_lcore_var_lcore(unsigned int lcore_id, void *handle)
{
+ RTE_ASSERT(handle != NULL);
return RTE_PTR_ADD(handle, lcore_id * RTE_MAX_LCORE_VAR);
}
/* >8 end of access function */
--
2.47.0
More information about the dev
mailing list