From patchwork Fri Apr 15 14:32:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Kulasek X-Patchwork-Id: 12093 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 171904AAD; Fri, 15 Apr 2016 16:33:19 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 57DB32C18 for ; Fri, 15 Apr 2016 16:33:17 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 15 Apr 2016 07:33:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,487,1455004800"; d="scan'208";a="955734300" Received: from unknown (HELO Sent) ([10.217.248.133]) by orsmga002.jf.intel.com with SMTP; 15 Apr 2016 07:33:05 -0700 Received: by Sent (sSMTP sendmail emulation); Fri, 15 Apr 2016 16:33:04 +0200 From: Tomasz Kulasek To: dev@dpdk.org Cc: helin.zhang@intel.com, konstantin.ananyev@intel.com Date: Fri, 15 Apr 2016 16:32:59 +0200 Message-Id: <1460730779-8200-1-git-send-email-tomaszx.kulasek@intel.com> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] ixgbe: fix bad shift operation in ixgbe_set_pool_tx X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" CID 13190 (#1 of 1): Bad bit shift operation (BAD_SHIFT) large_shift: In expression 1 << pool, left shifting by more than 31 bits has undefined behavior. The shift amount, pool, is at least 32. This patch limits mask shift to be in range of 32 bit PFVFTE[1] register, for pool > 31. Fixes: fe3a45fd4104 ("ixgbe: add VMDq support") Signed-off-by: Tomasz Kulasek Acked-by: Wenzhuo Lu --- drivers/net/ixgbe/ixgbe_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index f676a64..6ae82e7 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -4428,7 +4428,7 @@ ixgbe_set_pool_tx(struct rte_eth_dev *dev, uint16_t pool, uint8_t on) addr = IXGBE_VFTE(pool >= ETH_64_POOLS/2); reg = IXGBE_READ_REG(hw, addr); - val = bit1 << pool; + val = bit1 << (pool & 0x01F); if (on) reg |= val;