From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 131AD9AC2 for ; Tue, 24 Mar 2015 11:48:28 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 24 Mar 2015 03:48:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,458,1422950400"; d="scan'208";a="696863147" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by fmsmga002.fm.intel.com with ESMTP; 24 Mar 2015 03:48:26 -0700 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.247]) by IRSMSX104.ger.corp.intel.com ([169.254.5.138]) with mapi id 14.03.0224.002; Tue, 24 Mar 2015 10:48:26 +0000 From: "Jastrzebski, MichalX K" To: Thomas Monjalon , "Mrzyglod, DanielX T" , Olivier MATZ Thread-Topic: [dpdk-dev] [PATCH] cmdline: fix type format from unsigned to size_t for buffer size Thread-Index: AQHQZV9SdoPFyRSsCUqo4hKhuxNABZ0ragiw Date: Tue, 24 Mar 2015 10:48:25 +0000 Message-ID: <60ABE07DBB3A454EB7FAD707B4BB158213902C97@IRSMSX109.ger.corp.intel.com> References: <1424449085-82466-1-git-send-email-danielx.t.mrzyglod@intel.com> <54EC5A9C.3060008@6wind.com> <2042259.HzLBmuaM6Z@xps13> In-Reply-To: <2042259.HzLBmuaM6Z@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] cmdline: fix type format from unsigned to size_t for buffer size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Mar 2015 10:48:29 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon > Sent: Monday, March 23, 2015 12:47 PM > To: Mrzyglod, DanielX T > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] cmdline: fix type format from unsigned to > size_t for buffer size >=20 > Daniel, > Without answer to the question from Olivier, this patch is going to be > ignored. >=20 > 2015-02-24 12:03, Olivier MATZ: > > Hi Daniel, > > > > On 02/20/2015 05:18 PM, Daniel Mrzyglod wrote: > > > Function match_inst is used to take buffor using sizeof() which is si= ze_t > type. > > > This modification also involved changing '%u' to '%zu' in printf func= tion. > > > > > > Signed-off-by: Daniel Mrzyglod > > > --- > > > lib/librte_cmdline/cmdline_parse.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/lib/librte_cmdline/cmdline_parse.c > b/lib/librte_cmdline/cmdline_parse.c > > > index dfc885c..0821791 100644 > > > --- a/lib/librte_cmdline/cmdline_parse.c > > > +++ b/lib/librte_cmdline/cmdline_parse.c > > > @@ -138,7 +138,7 @@ nb_common_chars(const char * s1, const char * > s2) > > > */ > > > static int > > > match_inst(cmdline_parse_inst_t *inst, const char *buf, > > > - unsigned int nb_match_token, void *resbuf, unsigned resbuf_size) > > > + unsigned int nb_match_token, void *resbuf, size_t resbuf_size) > > > { > > > unsigned int token_num=3D0; > > > cmdline_parse_token_hdr_t * token_p; > > > @@ -169,7 +169,7 @@ match_inst(cmdline_parse_inst_t *inst, const > char *buf, > > > > > > if (token_hdr.offset > resbuf_size) { > > > printf("Parse error(%s:%d): Token offset(%u) > " > > > - "exceeds maximum size(%u)\n", > > > + "exceeds maximum size(%zu)\n", > > > __FILE__, __LINE__, > > > token_hdr.offset, resbuf_size); > > > return -ENOBUFS; > > > > > > > > > Did you see a specific issue with the current code? (maybe a compilatio= n > > issue or a klocwork issue?) Hi Olivier, Thomas Yes, this is an issue reported by the static analysis tool. > > > > I think this patch is ok, but there are many places where this kind > > of fixes should be applied in cmdline (cmdline_parse_*(), > > cmdline_get_help_*(), etc.). Is there a motivation for changing it > > only there? The tool we use didn't reported other places,=20 that is why Daniel send only this one change. > > > > Regards, > > Olivier > > >=20