From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f177.google.com (mail-wr0-f177.google.com [209.85.128.177]) by dpdk.org (Postfix) with ESMTP id D82B5F04 for ; Thu, 28 Sep 2017 08:55:04 +0200 (CEST) Received: by mail-wr0-f177.google.com with SMTP id b21so891559wrg.7 for ; Wed, 27 Sep 2017 23:55:04 -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:in-reply-to:references; bh=G5XCpty19tugwFnbouLKcu381P6A6lRDxh52lHaObuY=; b=Tblf6QTOfRA7DG+N+W80AKtfvbk/8mvjfxTY8fZG//InyKtbb39gTAZeXElw2ik3dg QnTxAd8B/bGcEGCwBqquW9n6dmz76C2M/iFRw0SOuDngEcV/lV9SF0utweQT5HHOo4i5 3TTEdv8D5g5xhxFLJbPZxhaezTsgah1DooiUgtBvmED22ALh193EHvjNOJ8onA2EbM1E OMg4J2S5TKLgld9EQuTx0eXUb/AH+3QdfOQ0ZDQLgXmdjjYGPfMnwKmst6heFhY/ob/i mK1LXbL6VYiCvzUTaIBVuloGld4QK8ZKRKdgzUDCNIXmAdHhYnAV7hluPkKMNHwTsVdH 3u8g== 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:in-reply-to :references; bh=G5XCpty19tugwFnbouLKcu381P6A6lRDxh52lHaObuY=; b=EmLs128GU8Eg1TZ/RM1Bbaak2ytKhhnl3gKhI6N5nwNNrOdxFWclwN2sZnhRx5a+Tr dub3NlgempBIfqgqFwlmFfBCvbqJ8VU7mGk+nzu2qXR/u+u21us7FRiH6jTlUuvVIsIq AWVNWT3LBhsse/SdUBdMPoNsX511hrqs9pW7Trtktfs+EcFpm7GextrQDwZWfhnZbCOy yIE/ya5Zz5HkLjtsL1TqUwm221oABlFrnqAfSvxdQqhv7vtzTXy8cGV42llnAk+wefOk 4N+DIDHjOkCRziQ7WurUB8UDghO20CMkPtLG8EDmV73urZ1EfGijuqaNqtPJD/8bZed3 4GBw== X-Gm-Message-State: AMCzsaVmF1VYhM7DUF7uoI03NeX38SJKQMaM2tk6U2Ik4o/HUEcQF3B2 zClI9sFFflEhwE/sgynt369frz08A+M= X-Google-Smtp-Source: AOwi7QD8m1JjpShYicEdaRTc755l2IGQCfwxDoDZ88Od524Zn5VCM37uqQPUv1+Sl4JItRjJlHEn6Q== X-Received: by 10.25.216.85 with SMTP id p82mr1615214lfg.21.1506581704385; Wed, 27 Sep 2017 23:55:04 -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 o28sm105071lfc.9.2017.09.27.23.55.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Sep 2017 23:55:03 -0700 (PDT) From: Lukasz Majczak To: dev@dpdk.org Cc: stable@dpdk.org, Lukasz Majczak Date: Thu, 28 Sep 2017 08:54:59 +0200 Message-Id: <20170928065459.6616-1-lma@semihalf.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170925073441.23494-1-lma@semihalf.com> References: <20170925073441.23494-1-lma@semihalf.com> Subject: [dpdk-dev] [PATCH v4] 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: , X-List-Received-Date: Thu, 28 Sep 2017 06:55:05 -0000 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. 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") Signed-off-by: Lukasz Majczak Acked-by: Jan Viktorin Acked-by: Chao Zhu --- 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) -- 2.14.1