mbuf: explicit cast of external buffer length

GCC 8.1 warned:

rte_common.h:141:34:
warning: conversion from 'long unsigned int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
 #define RTE_PTR_DIFF(ptr1, ptr2) ((uintptr_t)(ptr1) - (uintptr_t)(ptr2))
                                  ^
rte_mbuf.h:1360:13:
note: in expansion of macro 'RTE_PTR_DIFF'
  *buf_len = RTE_PTR_DIFF(shinfo, buf_addr);

Fixes: a53aa2b9f3 ("mbuf: support attaching external buffer")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
Andy Green 2018-05-17 21:49:42 +08:00 committed by Thomas Monjalon
parent 553ff494cb
commit 0298bfb263

View File

@ -1360,7 +1360,7 @@ rte_pktmbuf_ext_shinfo_init_helper(void *buf_addr, uint16_t *buf_len,
shinfo->fcb_opaque = fcb_opaque;
rte_mbuf_ext_refcnt_set(shinfo, 1);
*buf_len = RTE_PTR_DIFF(shinfo, buf_addr);
*buf_len = (uint16_t)RTE_PTR_DIFF(shinfo, buf_addr);
return shinfo;
}