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 066011C6E5 for ; Mon, 14 May 2018 07:11:17 +0200 (CEST) From: Andy Green To: dev@dpdk.org Date: Mon, 14 May 2018 13:11:13 +0800 Message-ID: <152627467320.53156.4096945333287945330.stgit@localhost.localdomain> In-Reply-To: <152627436523.53156.4398253089110011263.stgit@localhost.localdomain> References: <152627436523.53156.4398253089110011263.stgit@localhost.localdomain> User-Agent: StGit/unknown-version Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH v4 21/23] rte_ip.h: cast type decided by sizeof to uint32 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: Mon, 14 May 2018 05:11:17 -0000 /projects/lagopus/src/dpdk/build/include/rte_ip.h: In function 'rte_ipv4_udptcp_cksum': /projects/lagopus/src/dpdk/build/include/rte_byteorder.h: 51:24: warning: conversion from 'long unsigned int' to 'uint32_t' {aka 'unsigned int'} may change value [-Wconversion] #define rte_bswap16(x) ((uint16_t) (__builtin_constant_p(x) ? \ ^ /projects/lagopus/src/dpdk/build/include/rte_byteorder.h: 85:29: note: in expansion of macro 'rte_bswap16' #define rte_be_to_cpu_16(x) rte_bswap16(x) ^~~~~~~~~~~ /projects/lagopus/src/dpdk/build/include/rte_ip.h:321:11: note: in expansion of macro 'rte_be_to_cpu_16' l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) - ^~~~~~~~~~~~~~~~ Signed-off-by: Andy Green --- lib/librte_net/rte_ip.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index 8689e9113..88dfbaa9a 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -318,8 +318,8 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) uint32_t cksum; uint32_t l4_len; - l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) - - sizeof(struct ipv4_hdr); + l4_len = (uint32_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) - + sizeof(struct ipv4_hdr)); cksum = rte_raw_cksum(l4_hdr, l4_len); cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0);