From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bruce.richardson@intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id D74D7C89C
 for <dev@dpdk.org>; Fri, 26 Jun 2015 16:05:22 +0200 (CEST)
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by fmsmga101.fm.intel.com with ESMTP; 26 Jun 2015 07:05:19 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.13,685,1427785200"; d="scan'208";a="514675751"
Received: from nfritz1-mobl.amr.corp.intel.com ([10.254.80.87])
 by FMSMGA003.fm.intel.com with SMTP; 26 Jun 2015 07:05:17 -0700
Received: by  (sSMTP sendmail emulation); Fri, 26 Jun 2015 15:05:17 +0025
Date: Fri, 26 Jun 2015 15:05:17 +0100
From: Bruce Richardson <bruce.richardson@intel.com>
To: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Message-ID: <20150626140516.GA9956@bricha3-MOBL3>
References: <1435307833-7432-1-git-send-email-danielx.t.mrzyglod@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1435307833-7432-1-git-send-email-danielx.t.mrzyglod@intel.com>
Organization: Intel Shannon Ltd.
User-Agent: Mutt/1.5.23 (2014-03-12)
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] cfgfile: fix unitialised buffer and improve
 reading from nfs filesystem.
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jun 2015 14:05:23 -0000

On Fri, Jun 26, 2015 at 10:37:13AM +0200, Daniel Mrzyglod wrote:
> Nature of the problem was not initialised buffer[256] on special condition
> there were probability that program will work on unitialised data that
> could provide unexpected program behaviour.
> 
> Adding additional transparent I/O buffer for I/O operations
> improve reading on heavyloaded enviroments with NFS.
> 
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
> ---
>  lib/librte_cfgfile/rte_cfgfile.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c
> index b81c273..88fcb46 100644
> --- a/lib/librte_cfgfile/rte_cfgfile.c
> +++ b/lib/librte_cfgfile/rte_cfgfile.c
> @@ -93,10 +93,14 @@ rte_cfgfile_load(const char *filename, int flags)
>  	int curr_section = -1;
>  	int curr_entry = -1;
>  	char buffer[256];
> +	char f_streambuff[BUFSIZ];
>  	int lineno = 0;
>  	struct rte_cfgfile *cfg = NULL;
> +	memset(buffer, '\0', 256*sizeof(char));
> +	memset(f_streambuff, '\0', BUFSIZ);

Need a blank line before the memsets.
The 256*sizeof(char) needs whitespace around it - however, it's probably best
just replaced by "sizeof(buffer)". For consistency, the same change could be
made to the f_streambuff memset too.

/Bruce