From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by dpdk.org (Postfix) with ESMTP id 73CA75593 for ; Thu, 7 Jun 2018 11:44:24 +0200 (CEST) Received: by mail-lf0-f49.google.com with SMTP id i83-v6so13657874lfh.5 for ; Thu, 07 Jun 2018 02:44:24 -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=6aPS9zacyRt/YZZqxi0ljp+6utQ50MSMnmhk9MI23ng=; b=2Q4EtMI+68rsCjORJ+WStOV/1+X7+sMrtoP3MLlh8fBGoHhyAusiamIsRuBlMHltYX s0IQEnA/otf17RRSaDCl6ctLbkzoyqUv34HIk+5tn7NSvn0KjBF9xo1uxsQQO0imZ2yp oH5dRRRouQnnBWbFU9KlN3tzX/CUxHLVSrmlv81nlbvtRwQzjtcwLltt/BkAxqxNPY09 Fk7CaskbTP+i+BpZBTFVO2e2WuRoPEmVLvZyrI+HtKrS9tF2+MZ9f5qq92Xwe1w+6RXW WWsfpuriOn7XN76b21wsKs1vJBt8kA3VnKrT66eTjjvX01va/GgfTNeQNY4f3JAMyd6Y i96A== 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=6aPS9zacyRt/YZZqxi0ljp+6utQ50MSMnmhk9MI23ng=; b=DZrNeBA/Bl1vGT05KLihtEazBmDZ/r9d1uj33GZrp30ix4fhmVFhDxE+Rri0YtLIP0 DLn3yP3Ldq6Xhy6IDw29h24PQ5D6IeeTYDa6RhiJUtj++rmtwAtIWcezxZ4prKUH7oCj MIOw0lof0XtWlV3lQZqbINbmfjUjIdB3Fe8+Mvq2KMlOvdXDe4Fd2TnMA3OtG1oxUxju OrwOD20CvyAec3jADmBwEojwXlyppoFnJy14Fao3u+hVdLJjBuVpfPfVtKjG11Q/1nQy gFklCbbWZvbWwE6aA8VWOC5F3aFL2dtXNqkmGL4IeXmJeQxwTYqNCVtr+a43/Lo7zQSy LvfQ== X-Gm-Message-State: APt69E3qIXgdJnOZisIBrlOjvo7BlmwhPf1ak94sjDhISPk/DO26YPRb rLkn75DOiw9x9wNB0v5SRFg7hU6Zbvk= X-Google-Smtp-Source: ADUXVKJS5WWvbIbQjRdLsKPdc7fUtM0t2rzpSZpdmj0MLlUAYnK8hJgYgCjl0XDtnf2jByrMtVI8bg== X-Received: by 2002:a2e:8257:: with SMTP id j23-v6mr943409ljh.1.1528364664138; Thu, 07 Jun 2018 02:44:24 -0700 (PDT) Received: from mkPC.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id p28-v6sm3612368lfh.24.2018.06.07.02.44.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 02:44:22 -0700 (PDT) From: Michal Krawczyk To: Marcin Wojtas , Michal Krawczyk , Guy Tzalik , Evgeny Schemeilin Cc: dev@dpdk.org, matua@amazon.com, Rafal Kozik Date: Thu, 7 Jun 2018 11:43:20 +0200 Message-Id: <20180607094322.14312-25-mk@semihalf.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180607094322.14312-1-mk@semihalf.com> References: <20180607094322.14312-1-mk@semihalf.com> Subject: [dpdk-dev] [PATCH v3 25/27] net/ena: fix GENMASK_ULL macro 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, 07 Jun 2018 09:44:24 -0000 From: Rafal Kozik When use GENMASK_ULL(63,0) left shift by 64 bits is performed. Shifting by number greater or equal then word length is undefined operation and failed on some platforms. Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK") Signed-off-by: Rafal Kozik Acked-by: Michal Krawczyk --- drivers/net/ena/base/ena_plat_dpdk.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h index 22d7a9cb1..8a04e84b9 100644 --- a/drivers/net/ena/base/ena_plat_dpdk.h +++ b/drivers/net/ena/base/ena_plat_dpdk.h @@ -116,11 +116,13 @@ typedef uint64_t dma_addr_t; #define ENA_MIN16(x, y) RTE_MIN((x), (y)) #define ENA_MIN8(x, y) RTE_MIN((x), (y)) +#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) #define U64_C(x) x ## ULL #define BIT(nr) (1UL << (nr)) #define BITS_PER_LONG (__SIZEOF_LONG__ * 8) #define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) -#define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l)) +#define GENMASK_ULL(h, l) (((~0ULL) - (1ULL << (l)) + 1) & \ + (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) #ifdef RTE_LIBRTE_ENA_COM_DEBUG #define ena_trc_dbg(format, arg...) \ -- 2.14.1