From patchwork Thu Sep 21 13:04:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majczak X-Patchwork-Id: 29066 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3CFB91B1A2; Thu, 21 Sep 2017 15:04:22 +0200 (CEST) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com [209.85.215.46]) by dpdk.org (Postfix) with ESMTP id 642847D4E for ; Thu, 21 Sep 2017 15:04:21 +0200 (CEST) Received: by mail-lf0-f46.google.com with SMTP id k23so5678147lfi.11 for ; Thu, 21 Sep 2017 06:04:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=s4QR2vuNfEs9YkowpVZxYYzbFU4F21gqxjol3odWhY4=; b=I3iONDvF+OJhlZUg73mXRael4zklTRXmohSsDCwJm6QWUEFAS+8pvKGM7ssPCI9lH9 O8vC4MDeDnaE6V8/yAQfs3f8jpOtHrzZCVq6OpzpiNheqE+oKvCbVlUKuzssPFeYK8on 6w7+6paC21qJQOqx8upbLQtxalD/WfQcDRKWmLSx1id0DivI8YUHkvblqsJY/MQhUQoD SFvji2LFe2brlJ9qjaS/URkFGB9ew+QCRZebkuNNLjkqAMldBQlaJlFVQQS48RdYEE9e ruWr7jhLVh4+YRIJCVUArvYgvv2PPXu0Wle1BWZZ8ZnaBSd2XhdIlgUzugvudhyIbtIH 6XFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=s4QR2vuNfEs9YkowpVZxYYzbFU4F21gqxjol3odWhY4=; b=tjXMOGdOIwkFZo8Gtcl16n1Hr3q+rydHYC5j+plj/mmymjDklkT3hnKbiC4gvZ3qBx BV2nPqQ8Kd4EatuXgkDhy+IPJ4NDd5a6300y1+8xGuH4pvA0utMQRBdBr6YZ/46zWnEx Q1aU6uHo6Ki/6VmvTLwd4nNalZgcmNAoX7vfLyi6n9pd3jpFcq13nYe9Tex6ZDjAKEAo C80b+X1wf1PZ4Jz1IS5sPhX+5JLMP+GgrJlXrq73tQBFkesc7jVT+Xv0jO5l4EWE1IXH nt50EvOx8sIY75H0gQ7ETxv5DEAKEnZcxi7TO+CQYmdyOOZxW6KRldVmRVjX46BIYlt8 p3HA== X-Gm-Message-State: AHPjjUgbU6O1lywptGV2NSEzDjD13K77XsFyJauzl3uQ/TrvHpHS9MYj DUFil3SkNOmZhbbIRd4wwbBgQs4Hcmk= X-Google-Smtp-Source: AOwi7QCrcGWwWwx8lohAKwh+3tMTaic02uealHFVYpbKo45Rn1Jnkjlxz+nP/JCLA6LCEKG17Zkolg== X-Received: by 10.46.66.197 with SMTP id h66mr1004386ljf.108.1505999060563; Thu, 21 Sep 2017 06:04:20 -0700 (PDT) Received: from deadpool.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id r2sm275133ljd.7.2017.09.21.06.04.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Sep 2017 06:04:19 -0700 (PDT) From: Lukasz Majczak To: viktorin@rehivetech.com, chaozhu@linux.vnet.ibm.com Cc: dev@dpdk.org, Lukasz Majczak Date: Thu, 21 Sep 2017 15:04:04 +0200 Message-Id: <20170921130404.4978-1-lma@semihalf.com> X-Mailer: git-send-email 2.14.1 Subject: [dpdk-dev] [PATCH] librte_eal: fix wrong assert for arm and ppc 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" 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. Signed-off-by: Lukasz Majczak Acked-by: Jan Viktorin --- 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(-) 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; auxv_fd = open("/proc/self/auxv", O_RDONLY); - assert(auxv_fd); + assert(auxv_fd != -1); while (read(auxv_fd, &auxv, sizeof(auxv)) == sizeof(auxv)) { if (auxv.a_type == AT_HWCAP) { out[REG_HWCAP] = 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; auxv_fd = open("/proc/self/auxv", O_RDONLY); - assert(auxv_fd); + assert(auxv_fd != -1); while (read(auxv_fd, &auxv, sizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t)) { if (auxv.a_type == AT_HWCAP)