From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f169.google.com (mail-wr0-f169.google.com [209.85.128.169]) by dpdk.org (Postfix) with ESMTP id 2D566F04 for ; Thu, 28 Sep 2017 08:55:04 +0200 (CEST) Received: by mail-wr0-f169.google.com with SMTP id 108so895509wra.5 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=h3sk1aH8JGTFFh8KE/GwofwfcVWLl6xm/8wQ9pBlUwbbsFll+Jjnx036bSeIIcrahg bI/jyweGYKgpc7lbbPCGxFW7nH3613dsAS+j1G64KueU9hzqwdoOmevNjsCUSqdn/O+q sXvb1WXgtSZ5oOXqUulGbO5rFSTXLSaez89hJrL8H+IUsJTvkHDbs6urdi/7dCCMI0Zk EZYLkqc+YfaMwzbRaoykOWPXTAAzbU+sBuxFXtzCArl6Swddpmh+dmvxNEQI2bJFD1Ro 7A99p8CL+DS+013m8ZMWy4lKtYVCvK6W8dYUVEpdV93pqdN5grCS7N/E1lMgNC4mvM+c RB1w== X-Gm-Message-State: AMCzsaU8w5ceioeBWIOz2YRSD0BHG8hM9grVUJ7OSRZeSz4naI2Xbyi+ cSP0RZ9hHOSFC0iDVl1XHs7T2Q== 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-stable] [PATCH v4] librte_eal: fix wrong assert for arm and ppc X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches 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