From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.warmcat.com (mail.warmcat.com [163.172.24.82]) by dpdk.org (Postfix) with ESMTP id 19B0C2C23 for ; Tue, 22 May 2018 03:24:43 +0200 (CEST) From: Andy Green To: dev@dpdk.org Cc: thomas@monjalon.net Date: Tue, 22 May 2018 09:24:37 +0800 Message-ID: <152695227738.111551.10673432630170296754.stgit@localhost.localdomain> In-Reply-To: <152695215195.111551.10652921922687464367.stgit@localhost.localdomain> References: <152695215195.111551.10652921922687464367.stgit@localhost.localdomain> User-Agent: StGit/unknown-version Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH v7 6/8] rte_mbuf.h: choose correct type for temp X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2018 01:24:43 -0000 /projects/lagopus/src/dpdk/build/include/rte_mbuf.h: In function 'rte_pktmbuf_linearize': /projects/lagopus/src/dpdk/build/include/rte_mbuf.h: 1873:32: warning: conversion to 'int' from 'uint32_t' {aka 'unsigned int'} may change the sign of the result [-Wsign-conversion] #define rte_pktmbuf_pkt_len(m) ((m)->pkt_len) ^ /projects/lagopus/src/dpdk/build/include/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); ^~~~~~~~~~~~~~~~~~~ /projects/lagopus/src/dpdk/build/include/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") Signed-off-by: Andy Green Acked-by: Bruce Richardson --- lib/librte_mbuf/rte_mbuf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 491503e47..0e89a6927 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -2161,7 +2161,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;