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 2EF8C7CF0 for ; Thu, 17 May 2018 15:49:46 +0200 (CEST) From: Andy Green To: dev@dpdk.org Date: Thu, 17 May 2018 21:49:42 +0800 Message-ID: <152656498234.46638.7377552443095530741.stgit@localhost.localdomain> In-Reply-To: <152656480225.46638.3271983577765861155.stgit@localhost.localdomain> References: <152656480225.46638.3271983577765861155.stgit@localhost.localdomain> User-Agent: StGit/unknown-version Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH v5 10/21] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 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: Thu, 17 May 2018 13:49:46 -0000 /projects/lagopus/src/dpdk/build/include/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)) ^ /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:1360:13: note: in expansion of macro 'RTE_PTR_DIFF' *buf_len = RTE_PTR_DIFF(shinfo, buf_addr); 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 a27dbb878..0580ec8a0 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1358,7 +1358,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; }