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.march...@redhat.com>
Acked-by: Anatoly Burakov <anatoly.bura...@intel.com>
Acked-by: Frode Nordahl <frode.nord...@canonical.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.48.1

Reply via email to