From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 28447C852 for ; Fri, 26 Jun 2015 10:38:01 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 26 Jun 2015 01:38:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,683,1427785200"; d="scan'208";a="753587373" Received: from unknown ([10.217.248.46]) by orsmga002.jf.intel.com with SMTP; 26 Jun 2015 01:37:58 -0700 Received: by (sSMTP sendmail emulation); Fri, 26 Jun 2015 10:37:15 +0200 From: Daniel Mrzyglod To: dev@dpdk.org Date: Fri, 26 Jun 2015 10:37:13 +0200 Message-Id: <1435307833-7432-1-git-send-email-danielx.t.mrzyglod@intel.com> X-Mailer: git-send-email 2.1.4 Subject: [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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2015 08:38:01 -0000 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 --- 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); FILE *f = fopen(filename, "r"); + setbuf(f, f_streambuff); if (f == NULL) return NULL; -- 2.1.0