summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/librte_mbuf/rte_mbuf.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 4fd9a0d..eab13c6 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1345,12 +1345,14 @@ rte_pktmbuf_ext_shinfo_init_helper(void *buf_addr, uint16_t *buf_len,
{
struct rte_mbuf_ext_shared_info *shinfo;
void *buf_end = RTE_PTR_ADD(buf_addr, *buf_len);
+ void *addr;
- shinfo = RTE_PTR_ALIGN_FLOOR(RTE_PTR_SUB(buf_end,
- sizeof(*shinfo)), sizeof(uintptr_t));
- if ((void *)shinfo <= buf_addr)
+ addr = RTE_PTR_ALIGN_FLOOR(RTE_PTR_SUB(buf_end, sizeof(*shinfo)),
+ sizeof(uintptr_t));
+ if (addr <= buf_addr)
return NULL;
+ shinfo = (struct rte_mbuf_ext_shared_info *)addr;
shinfo->free_cb = free_cb;
shinfo->fcb_opaque = fcb_opaque;
rte_mbuf_ext_refcnt_set(shinfo, 1);