From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) by dpdk.org (Postfix) with ESMTP id 58759ADC2 for ; Tue, 24 Feb 2015 12:03:57 +0100 (CET) Received: by wesx3 with SMTP id x3so24395488wes.6 for ; Tue, 24 Feb 2015 03:03:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=bXDgBCmTdP7WxZtC3meo16+gI4oeYoYcQ8ZU6oFIjg8=; b=a5STmKrvl0j+jY+nvOiC7WSvnPC4JmeYqu+fPl3zYgRTLn0mrEWHlQXlYZLdQ/pfGM ALvQ4za3b2OviSTZHWYUvl5pAipTVqrvp3Uaf97IiTo0hnkB4yNn6JlZ36HARYM7biwv zTi+nTC88dWGmPKPNMSbDIlXSI2j9fOVi9CBx6RVZpk+6Po8YrRf5otiBbPG/w6iQ2v0 oHl+2txXh/SmtDb+l48RGAD3Mf95016iGCIl8cIOrNq7Tz+O3Pzk8+MMJoYaY4QnD8JA +l1mmygJQUT1T+C7mgzXLe+obGTqX5xdCBXKZkbkWISOfMr0iRfTBiipllCGtSrF52XX 9NIg== X-Gm-Message-State: ALoCoQkCbnC2S4nUvs4xwyAnZfuGBh/rmr0ftHIb4da2EMJuG7oi6fjOlVZkWngl1ZRX1QZDjZ4W X-Received: by 10.180.211.172 with SMTP id nd12mr29235203wic.88.1424775837203; Tue, 24 Feb 2015 03:03:57 -0800 (PST) Received: from [10.16.0.195] (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id md8sm19998073wic.13.2015.02.24.03.03.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2015 03:03:56 -0800 (PST) Message-ID: <54EC5A9C.3060008@6wind.com> Date: Tue, 24 Feb 2015 12:03:56 +0100 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.2.0 MIME-Version: 1.0 To: Daniel Mrzyglod , dev@dpdk.org References: <1424449085-82466-1-git-send-email-danielx.t.mrzyglod@intel.com> In-Reply-To: <1424449085-82466-1-git-send-email-danielx.t.mrzyglod@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 Feb 2015 11:03:57 -0000 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