From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Chao Zhu" Subject: Re: [PATCH v3] librte_eal: fix wrong assert for arm and ppc Date: Thu, 28 Sep 2017 10:01:43 +0800 Message-ID: <000b01d337fd$bc6d4e50$3547eaf0$@linux.vnet.ibm.com> References: <20170921155953.9984-1-lma@semihalf.com> <20170925073441.23494-1-lma@semihalf.com> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable To: "'Lukasz Majczak'" , Return-path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by dpdk.org (Postfix) with ESMTP id B84E5DD2 for ; Thu, 28 Sep 2017 04:01:50 +0200 (CEST) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8S1wYkS036017 for ; Wed, 27 Sep 2017 22:01:50 -0400 Received: from e23smtp05.au.ibm.com (e23smtp05.au.ibm.com [202.81.31.147]) by mx0b-001b2d01.pphosted.com with ESMTP id 2d8jfb7kpk-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 27 Sep 2017 22:01:49 -0400 Received: from localhost by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 Sep 2017 12:01:46 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v8S21jT943647070 for ; Thu, 28 Sep 2017 12:01:45 +1000 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v8S21juC006943 for ; Thu, 28 Sep 2017 12:01:45 +1000 In-Reply-To: <20170925073441.23494-1-lma@semihalf.com> Content-Language: zh-cn List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Lukasz Majczak > Sent: 2017=C4=EA9=D4=C225=C8=D5 15:35 > To: dev@dpdk.org > Cc: Lukasz Majczak > Subject: [dpdk-dev] [PATCH v3] librte_eal: fix wrong assert for arm = and ppc >=20 > The assertion of return value from the open() function is done against = 0, while it > is a correct value - open() returns -1 in case of an error. > It causes problems while trying to run as a daemon, in which case, = this call to > open() will return 0 as a valid descriptor. >=20 > Fixes: b94e5c9406b5 ("eal/arm: add CPU flags for ARMv7") > Fixes: 97523f822ba9 ("eal/arm: add CPU flags for ARMv8") > Fixes: 9ae155385686 ("eal/ppc: cpu flag checks for IBM Power") >=20 > Signed-off-by: Lukasz Majczak > --- > lib/librte_eal/common/arch/arm/rte_cpuflags.c | 2 +- > lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/lib/librte_eal/common/arch/arm/rte_cpuflags.c > b/lib/librte_eal/common/arch/arm/rte_cpuflags.c > index 5636e9c1d..88f1cbe37 100644 > --- a/lib/librte_eal/common/arch/arm/rte_cpuflags.c > +++ b/lib/librte_eal/common/arch/arm/rte_cpuflags.c > @@ -137,7 +137,7 @@ rte_cpu_get_features(hwcap_registers_t out) > _Elfx_auxv_t auxv; >=20 > auxv_fd =3D open("/proc/self/auxv", O_RDONLY); > - assert(auxv_fd); > + assert(auxv_fd !=3D -1); > while (read(auxv_fd, &auxv, sizeof(auxv)) =3D=3D sizeof(auxv)) { > if (auxv.a_type =3D=3D AT_HWCAP) { > out[REG_HWCAP] =3D auxv.a_un.a_val; > diff --git a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c > b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c > index fcf96e045..970a61c5e 100644 > --- a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c > +++ b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c > @@ -108,7 +108,7 @@ rte_cpu_get_features(hwcap_registers_t out) > Elf64_auxv_t auxv; >=20 > auxv_fd =3D open("/proc/self/auxv", O_RDONLY); > - assert(auxv_fd); > + assert(auxv_fd !=3D -1); > while (read(auxv_fd, &auxv, > sizeof(Elf64_auxv_t)) =3D=3D sizeof(Elf64_auxv_t)) { > if (auxv.a_type =3D=3D AT_HWCAP) > -- > 2.14.1 Acked-by: Chao Zhu