From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by dpdk.org (Postfix) with ESMTP id D0C7D7CA3 for ; Mon, 4 Jun 2018 14:10:18 +0200 (CEST) Received: by mail-lf0-f68.google.com with SMTP id n3-v6so24831003lfe.12 for ; Mon, 04 Jun 2018 05:10:18 -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=CV5EnUpcEg7txIHfHZBh/6xTWSxH/DpV6ctPsM7SCavlwPwNjvXOx/ZzzZZf0GvT7d N2lshH5eTMJt5OyT3Yt99iQgIjCoTaSSqKgXXuzDOvNrSzabvAUBQWjNmAaTmvK8P1kk O0m518J+OJg9fWCkEQoU3k4CnIJUooRcXhSDARlvGko19cRe0J5KiK5H70qCin79r9hb tTBBDYQnCvMYWbbJjsm4AkRXw7/z6P0HaYB77jxBHvlpICk9w1n75pz2DySD5Hs8l8Ps 65wiS0+9+kHbiJrMg+n7WKax+Lrz8DVTPDUj9etM7O8PXfxfmEeRiTxUz6R29TuA7ImV KY7g== 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=Jv0siiYeg+/1lraucDstsu0SIHpGgQV3/3LWjyq+OlnFfqjImF7DUmY+Ye9PM7rmxb 411q8Qsy/XSTw6lYM6aX2COO93xGurLH+y+e/IjlRxMGOzNGZ1cQPEYVmo9JcZeCM0+E ckcmCMOKx3urp2Kw4Dp/YmorRCU9r9brq5VlPUQLxUtM8jWRDyF3o71aO/0UbXzx8zH8 GfKIQMBXDS5rB0t/Z7hx50Z4YDU0Jz60Lw5S/0P9IwVJESIrvhwFrwJ1A9/Kq0CgO8p2 lW6H42osGyMs4BSiBSK0vihtRdKWPGl0TjN4Ozd1bd6krzjkX98SiFA+xh5zA+LBdpl1 Zo4w== X-Gm-Message-State: APt69E2JN2Cz5ziXHWQGpE1hmtXj/rQ4z+J6fBRhwoSeO6DUsdjk+DKY w3ZJJBDyf7pWQiYelyN6L880Xw== X-Google-Smtp-Source: ADUXVKLwHm82wILX9QcxidC5SG4/dBa0gklE0aaAKd1xW4jDcHWMLWfEtr67Rj8vzX0C/hE0S4eK+A== X-Received: by 2002:a19:1797:: with SMTP id 23-v6mr1365192lfx.95.1528114218530; Mon, 04 Jun 2018 05:10:18 -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 g23-v6sm3817415lfi.49.2018.06.04.05.10.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 05:10:17 -0700 (PDT) From: Michal Krawczyk To: Marcin Wojtas , Michal Krawczyk , Guy Tzalik , Evgeny Schemeilin Cc: dev@dpdk.org, matua@amazon.com, Rafal Kozik Date: Mon, 4 Jun 2018 14:09:52 +0200 Message-Id: <20180604120955.17319-15-mk@semihalf.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180604120955.17319-1-mk@semihalf.com> References: <20180604120955.17319-1-mk@semihalf.com> Subject: [dpdk-dev] [PATCH v2 24/26] 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: Mon, 04 Jun 2018 12:10:19 -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