From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f181.google.com (mail-wr0-f181.google.com [209.85.128.181]) by dpdk.org (Postfix) with ESMTP id 12D42968 for ; Mon, 25 Sep 2017 09:34:46 +0200 (CEST) Received: by mail-wr0-f181.google.com with SMTP id l22so6169534wrc.10 for ; Mon, 25 Sep 2017 00:34:46 -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=+G8vVfCyLM6X7hsYVeJTHdcnZTzm3TrCbrmz8Yteu4k=; b=emlaD3YvypbdeekPnOkGTLUQPKqSvPSTHuyD2HlAjnAi/Lijgbt/sJ2CtuTS9BLcTz GDn3yORqrgG/ROtY8B/emoC5q0dpqy5mrIH7XTahrZXmXDDMUEuctlmQT4rd2TV8SjzS yI9ceKPPwfA/VVZCBbjEDfRkWNFOaLMUWlAriP9B+TXmrGDlNzd5ZRyh+gCp26xw/GOg wo0PPRJDbUCZqzqlbrE6Ry3UbRUzUgHcWsCSuZqqfdkDpHgrEEB9KcfbEfi/cgO0XwZD 4/fTaS1ow8KxPrLW7jwQ0bRIlXboXNGF+nxN5qqTcIs3fvCbh0uHAkKVGSDuEb8GLBmW jrMA== 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=+G8vVfCyLM6X7hsYVeJTHdcnZTzm3TrCbrmz8Yteu4k=; b=dgD8FY1m7L82ZdLPRxKqT8czN/A3/1Z/gpkkfind3RiiO4B70InmOz1vPQdE3VVxOS xXTOTWRw1LVCul9LM9UyziowKgFiSL52LAkrhURDGcmrBQDSL7R8eyZKgticce5zLWwL DWzDg1CNZ7mT7P97mKzTGyJyI/NPPV+2U+Xl5hOLXcwlm/wEj/hiwZTTMDZgOhDC2inN sCkZNvaYVdRBHCYMmJBAcEwtywDZ4rEURQVxIspcygJp210PJQfI783MD8bWqzqaL5b0 Yx5KwP8BggFT+fMC4ZoF+jRo3nCYd9JHH2cERcEsAMcXLtlO3W4Ftg0x1PNxhTup4j2n dZyg== X-Gm-Message-State: AHPjjUg2G95jOlWruqXhUQDaCl873C8QcQBNK1a3SD7awokgS7jbNxFj H+6u9si7TnjTFlarQe38CyGgyXrblyM= X-Google-Smtp-Source: AOwi7QDC8m7CoQODb29vtHoP+tyWolP4AB0TPD1OJFbyWnmkEOHt9ha/OXnPFEH5S1biG7QTKokB5w== X-Received: by 10.46.101.208 with SMTP id e77mr2365484ljf.52.1506324885647; Mon, 25 Sep 2017 00:34:45 -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 r84sm1279396ljb.82.2017.09.25.00.34.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Sep 2017 00:34:44 -0700 (PDT) From: Lukasz Majczak To: dev@dpdk.org Cc: Lukasz Majczak Date: Mon, 25 Sep 2017 09:34:41 +0200 Message-Id: <20170925073441.23494-1-lma@semihalf.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170921155953.9984-1-lma@semihalf.com> References: <20170921155953.9984-1-lma@semihalf.com> Subject: [dpdk-dev] [PATCH v3] 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: Mon, 25 Sep 2017 07:34:46 -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 --- 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