path: root/lib/librte_mbuf
diff options
authorAndy Green <>2018-05-22 09:24:37 +0800
committerThomas Monjalon <>2018-05-22 16:32:36 +0200
commit50f239c9087df9b1a3c14e77f4279c7d5f523138 (patch)
tree3a766acf35ac572ed0e4e042f266b0c7cba089ea /lib/librte_mbuf
parentad3781066261848c163e700c3c5baa16fecc2247 (diff)
mbuf: fix type of variables in linearize function
GCC 8.1 warned: In function 'rte_pktmbuf_linearize': rte_mbuf.h:1873:32: warning: conversion to 'int' from 'uint32_t' {aka 'unsigned int'} may change the sign of the result [-Wsign-conversion] rte_mbuf.h:2166:13: note: in expansion of macro 'rte_pktmbuf_pkt_len' copy_len = rte_pktmbuf_pkt_len(mbuf) - rte_pktmbuf_data_len(mbuf); rte_mbuf.h:2180:51: warning: conversion to 'size_t' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion] rte_memcpy(buffer, rte_pktmbuf_mtod(m, char *), seg_len); ^~~~~~~ The temp is consumed as a size_t. So let's make it a size_t in the first place. Fixes: 1feda4d8fc ("mbuf: add a function to linearize a packet") Cc: Signed-off-by: Andy Green <> Acked-by: Bruce Richardson <>
Diffstat (limited to 'lib/librte_mbuf')
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 76e37a2..715f90e 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -2157,7 +2157,7 @@ rte_validate_tx_offload(const struct rte_mbuf *m)
static inline int
rte_pktmbuf_linearize(struct rte_mbuf *mbuf)
- int seg_len, copy_len;
+ size_t seg_len, copy_len;
struct rte_mbuf *m;
struct rte_mbuf *m_next;
char *buffer;