From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 3DFA35A6A for ; Fri, 10 May 2019 16:55:48 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 May 2019 07:55:47 -0700 X-ExtLoop1: 1 Received: from bricha3-mobl.ger.corp.intel.com ([10.252.21.38]) by orsmga007.jf.intel.com with SMTP; 10 May 2019 07:55:43 -0700 Received: by (sSMTP sendmail emulation); Fri, 10 May 2019 15:55:42 +0100 Date: Fri, 10 May 2019 15:55:42 +0100 From: Bruce Richardson To: Michael Santana Cc: dev@dpdk.org, Rasesh Mody , Shahed Shaikh , Matan Azrad , Anatoly Burakov , Byron Marohn , Pablo de Lara Guarch , Aaron Conole Message-ID: <20190510145541.GB87@bricha3-MOBL.ger.corp.intel.com> References: <20190510145312.409-1-msantana@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190510145312.409-1-msantana@redhat.com> User-Agent: Mutt/1.11.4 (2019-03-13) 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 14:55:48 -0000 On Fri, May 10, 2019 at 10:53:12AM -0400, 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 > --- > drivers/net/qede/base/bcm_osal.c | 4 ++-- > drivers/net/qede/qede_filter.c | 2 +- > drivers/net/vdev_netvsc/vdev_netvsc.c | 2 +- > examples/multi_process/client_server_mp/shared/common.h | 2 +- > examples/server_node_efd/shared/common.h | 2 +- > lib/librte_eal/common/eal_common_options.c | 3 +-- > lib/librte_eal/common/eal_filesystem.h | 9 ++++----- > lib/librte_eal/common/malloc_heap.c | 4 ++-- > 8 files changed, 13 insertions(+), 15 deletions(-) > Looks a good cleanup, thanks. Acked-by: Bruce Richardson 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 52C9BA0096 for ; Fri, 10 May 2019 16:55:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0D91B5B40; Fri, 10 May 2019 16:55:50 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 3DFA35A6A for ; Fri, 10 May 2019 16:55:48 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 May 2019 07:55:47 -0700 X-ExtLoop1: 1 Received: from bricha3-mobl.ger.corp.intel.com ([10.252.21.38]) by orsmga007.jf.intel.com with SMTP; 10 May 2019 07:55:43 -0700 Received: by (sSMTP sendmail emulation); Fri, 10 May 2019 15:55:42 +0100 Date: Fri, 10 May 2019 15:55:42 +0100 From: Bruce Richardson To: Michael Santana Cc: dev@dpdk.org, Rasesh Mody , Shahed Shaikh , Matan Azrad , Anatoly Burakov , Byron Marohn , Pablo de Lara Guarch , Aaron Conole Message-ID: <20190510145541.GB87@bricha3-MOBL.ger.corp.intel.com> References: <20190510145312.409-1-msantana@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline In-Reply-To: <20190510145312.409-1-msantana@redhat.com> User-Agent: Mutt/1.11.4 (2019-03-13) 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: <20190510145542.R1wz-7KdSPEvsWsOeTq5FHzzvmn8NJjGqjNSGj3DSpw@z> On Fri, May 10, 2019 at 10:53:12AM -0400, 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 > --- > drivers/net/qede/base/bcm_osal.c | 4 ++-- > drivers/net/qede/qede_filter.c | 2 +- > drivers/net/vdev_netvsc/vdev_netvsc.c | 2 +- > examples/multi_process/client_server_mp/shared/common.h | 2 +- > examples/server_node_efd/shared/common.h | 2 +- > lib/librte_eal/common/eal_common_options.c | 3 +-- > lib/librte_eal/common/eal_filesystem.h | 9 ++++----- > lib/librte_eal/common/malloc_heap.c | 4 ++-- > 8 files changed, 13 insertions(+), 15 deletions(-) > Looks a good cleanup, thanks. Acked-by: Bruce Richardson