[dpdk-stable] [PATCH 03/29] net/sfc/base: fix shift by more bits than field width
Andrew Rybchenko
arybchenko at solarflare.com
Mon Jun 10 09:38:18 CEST 2019
From: Mark Spender <mspender at solarflare.com>
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 at dpdk.org
Signed-off-by: Mark Spender <mspender at solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
---
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
More information about the stable
mailing list