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 CEDC91B68A for ; Fri, 3 Nov 2017 13:13:50 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Nov 2017 05:13:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,338,1505804400"; d="scan'208";a="1239293932" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by fmsmga002.fm.intel.com with ESMTP; 03 Nov 2017 05:13:49 -0700 Received: from irsmsx111.ger.corp.intel.com (10.108.20.4) by IRSMSX106.ger.corp.intel.com (163.33.3.31) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 3 Nov 2017 12:13:48 +0000 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.49]) by irsmsx111.ger.corp.intel.com ([169.254.2.30]) with mapi id 14.03.0319.002; Fri, 3 Nov 2017 12:13:48 +0000 From: "Singh, Jasvinder" To: "Iremonger, Bernard" , "dev@dpdk.org" Thread-Topic: [PATCH] examples/flow_classify: fix fseek error handling Thread-Index: AQHTUwpt0CwI+XUqDk2MYIAu0fao/6MCk+gQ Date: Fri, 3 Nov 2017 12:13:48 +0000 Message-ID: <54CBAA185211B4429112C315DA58FF6D332802B7@IRSMSX103.ger.corp.intel.com> References: <1509538229-1354-1-git-send-email-bernard.iremonger@intel.com> In-Reply-To: <1509538229-1354-1-git-send-email-bernard.iremonger@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTAwNmFkMzUtY2FjNC00YWIyLWExNTUtOGIwNTVlN2VhZjI5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IkxVN3pGVk8wTWV3UzFBVFQ1N1hTbU4xWnQwaHc0R242eGI2blMzdmozZmc9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] examples/flow_classify: fix fseek error handling 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, 03 Nov 2017 12:13:51 -0000 > -----Original Message----- > From: Iremonger, Bernard > Sent: Wednesday, November 1, 2017 12:10 PM > To: dev@dpdk.org; Singh, Jasvinder > Cc: Iremonger, Bernard > Subject: [PATCH] examples/flow_classify: fix fseek error handling >=20 > Check return value of fseek and exit if non zero. >=20 > Coverity issue: 143435 >=20 > Fixes: bab16ddaf2c1 ("examples/flow_classify: add sample application") > Signed-off-by: Bernard Iremonger > --- > examples/flow_classify/flow_classify.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) >=20 > diff --git a/examples/flow_classify/flow_classify.c > b/examples/flow_classify/flow_classify.c > index e4cabdb..766f1dd 100644 > --- a/examples/flow_classify/flow_classify.c > +++ b/examples/flow_classify/flow_classify.c > @@ -657,13 +657,17 @@ static __attribute__((noreturn)) void > unsigned int i =3D 0; > unsigned int total_num =3D 0; > struct rte_eth_ntuple_filter ntuple_filter; > + int ret; >=20 > fh =3D fopen(rule_path, "rb"); > if (fh =3D=3D NULL) > - rte_exit(EXIT_FAILURE, "%s: Open %s failed\n", __func__, > + rte_exit(EXIT_FAILURE, "%s: fopen %s failed\n", __func__, > rule_path); >=20 > - fseek(fh, 0, SEEK_SET); > + ret =3D fseek(fh, 0, SEEK_SET); > + if (ret) > + rte_exit(EXIT_FAILURE, "%s: fseek %d failed\n", __func__, > + ret); >=20 > i =3D 0; > while (fgets(buff, LINE_MAX, fh) !=3D NULL) { > -- > 1.9.1 Acked-by: Jasvinder Singh