From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] cmdline: fix type format from unsigned to size_t for buffer size Date: Mon, 23 Mar 2015 12:46:54 +0100 Message-ID: <2042259.HzLBmuaM6Z@xps13> References: <1424449085-82466-1-git-send-email-danielx.t.mrzyglod@intel.com> <54EC5A9C.3060008@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev-VfR2kkLFssw@public.gmane.org To: Daniel Mrzyglod Return-path: In-Reply-To: <54EC5A9C.3060008-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" Daniel, Without answer to the question from Olivier, this patch is going to be ignored. 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 size_t type. > > This modification also involved changing '%u' to '%zu' in printf function. > > > > 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=0; > > 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 compilation > issue or a klocwork issue?) > > 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? > > Regards, > Olivier >