From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 7A6E6374 for ; Fri, 10 May 2019 17:28:50 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 May 2019 08:28:48 -0700 X-ExtLoop1: 1 Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.252.16.183]) ([10.252.16.183]) by orsmga007.jf.intel.com with ESMTP; 10 May 2019 08:28:47 -0700 To: Michael Santana , dev@dpdk.org Cc: Rasesh Mody , Shahed Shaikh , Matan Azrad , Byron Marohn , Pablo de Lara Guarch , Aaron Conole References: <20190510145312.409-1-msantana@redhat.com> From: "Burakov, Anatoly" Message-ID: <48b2d5ee-f6a6-9954-a45b-d2a581c5ace3@intel.com> Date: Fri, 10 May 2019 16:28:46 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190510145312.409-1-msantana@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] Fix off-by-one errors in snprintf in various files 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: Fri, 10 May 2019 15:28:50 -0000 On 10-May-19 3:53 PM, Michael Santana wrote: > snprintf guarantees to always correctly place a null terminator in the buffer > string. So manually placing a null terminator in a buffer right after a call > to snprintf is redundant code. > > Additionally, there is no need to use 'sizeof(buffer) - 1' in snprintf as this > means we are not using the last character in the buffer. 'sizeof(buffer)' is > enough. > > Cc: stable@dpdk.org > > Signed-off-by: Michael Santana > --- LGTM Acked-by: Anatoly Burakov -- Thanks, Anatoly From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id B858AA0096 for ; Fri, 10 May 2019 17:28:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F390829D2; Fri, 10 May 2019 17:28:51 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 7A6E6374 for ; Fri, 10 May 2019 17:28:50 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 May 2019 08:28:48 -0700 X-ExtLoop1: 1 Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.252.16.183]) ([10.252.16.183]) by orsmga007.jf.intel.com with ESMTP; 10 May 2019 08:28:47 -0700 To: Michael Santana , dev@dpdk.org Cc: Rasesh Mody , Shahed Shaikh , Matan Azrad , Byron Marohn , Pablo de Lara Guarch , Aaron Conole References: <20190510145312.409-1-msantana@redhat.com> From: "Burakov, Anatoly" Message-ID: <48b2d5ee-f6a6-9954-a45b-d2a581c5ace3@intel.com> Date: Fri, 10 May 2019 16:28:46 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190510145312.409-1-msantana@redhat.com> Content-Type: text/plain; charset="UTF-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] Fix off-by-one errors in snprintf in various files 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190510152846.KJCKYQhzqWkHFeGTitzBGEQJFhjfdAsFbWvzTHp7lYs@z> On 10-May-19 3:53 PM, Michael Santana wrote: > snprintf guarantees to always correctly place a null terminator in the buffer > string. So manually placing a null terminator in a buffer right after a call > to snprintf is redundant code. > > Additionally, there is no need to use 'sizeof(buffer) - 1' in snprintf as this > means we are not using the last character in the buffer. 'sizeof(buffer)' is > enough. > > Cc: stable@dpdk.org > > Signed-off-by: Michael Santana > --- LGTM Acked-by: Anatoly Burakov -- Thanks, Anatoly