From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 8AA301B1CC for ; Mon, 21 May 2018 15:09:41 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2018 06:09:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,426,1520924400"; d="scan'208";a="201117466" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.55]) by orsmga004.jf.intel.com with SMTP; 21 May 2018 06:09:38 -0700 Received: by (sSMTP sendmail emulation); Mon, 21 May 2018 14:09:37 +0100 Date: Mon, 21 May 2018 14:09:37 +0100 From: Bruce Richardson To: Andy Green Cc: dev@dpdk.org, thomas@monjalon.net Message-ID: <20180521130936.GF22944@bricha3-MOBL.ger.corp.intel.com> References: <152686781484.58694.14737673447518527445.stgit@localhost.localdomain> <152686808344.58694.6871447575515047934.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <152686808344.58694.6871447575515047934.stgit@localhost.localdomain> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v6 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: Mon, 21 May 2018 13:09:42 -0000 On Mon, May 21, 2018 at 10:01:23AM +0800, Andy Green wrote: > /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 > --- > 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 55fba3b14..a0423a548 100644 > --- a/lib/librte_mbuf/rte_mbuf.h > +++ b/lib/librte_mbuf/rte_mbuf.h > @@ -2158,7 +2158,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; > Looks reasonable. Acked-by: Bruce Richardson