From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 3DB7BA0495 for ; Mon, 10 Jun 2019 09:40:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 276C61BEF8; Mon, 10 Jun 2019 09:39:25 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id A97621BE95; Mon, 10 Jun 2019 09:38:56 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us5.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id AA6314C0058; Mon, 10 Jun 2019 07:38:55 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 10 Jun 2019 00:38:51 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Mon, 10 Jun 2019 00:38:50 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x5A7cnac008755; Mon, 10 Jun 2019 08:38:49 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 129951627D7; Mon, 10 Jun 2019 08:38:49 +0100 (BST) From: Andrew Rybchenko To: CC: Mark Spender , Date: Mon, 10 Jun 2019 08:38:18 +0100 Message-ID: <1560152324-20538-4-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1560152324-20538-1-git-send-email-arybchenko@solarflare.com> References: <1560152324-20538-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24664.003 X-TM-AS-Result: No-8.458400-4.000000-10 X-TMASE-MatchedRID: 0wm7BrAfHYcWUcwJqSCXnbHcAAwD045wBnIRIVcCWN/FVLYz0PH8dfPD 3CqjqQZmp/dg3Z2NMCXusCHjf/LEbTiz+dBnC9kIGi6hW8XaLRnpVMb1xnESMo5JUK9UdYknE3Y JuuPqeQPWE964R7d6ncXz2YqqvrnJ6/Dbt0BmXRM/ApMPW/xhXkyQ5fRSh265gstfdkcDXJrcyO rXENN0xN1TeFi3Fi9wgDLqnrRlXrZ8nn9tnqel2DsAVzN+Ov/sJKTZYb82Bc6PcQVJWYh5GH0MJ AS1KW5I+khGID9rYSJbDy0IUDs74Q== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--8.458400-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24664.003 X-MDID: 1560152336-w9PBs6lI01Sg Subject: [dpdk-dev] [PATCH 03/29] net/sfc/base: fix shift by more bits than field width 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Mark Spender This was probably an oversight when support for multiple sensor pages was added. Despite being undefined behaviour in C, it probably worked on Intel x32/x64 as on them bit shift operations wrap round. Fixes: dfb3b1ce15f6 ("net/sfc/base: import monitors access via MCDI") Cc: stable@dpdk.org Signed-off-by: Mark Spender Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/base/mcdi_mon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/sfc/base/mcdi_mon.c b/drivers/net/sfc/base/mcdi_mon.c index b53de0d..d0247dc 100644 --- a/drivers/net/sfc/base/mcdi_mon.c +++ b/drivers/net/sfc/base/mcdi_mon.c @@ -73,7 +73,8 @@ /* This sensor is one of the page boundary bits. */ } - if (~(sensor_mask[page]) & (1U << sensor)) + if (~(sensor_mask[page]) & + (1U << (sensor % (sizeof (sensor_mask[page]) * 8)))) continue; /* This sensor not in DMA buffer */ -- 1.8.3.1