From: Mark Spender Date: Mon, 10 Jun 2019 07:38:18 +0000 (+0100) Subject: net/sfc/base: fix shift by more bits than field width X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1dcd3a98954075f3218d9bf1d00eaad250f92833;p=dpdk.git net/sfc/base: fix shift by more bits than field width 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 --- diff --git a/drivers/net/sfc/base/mcdi_mon.c b/drivers/net/sfc/base/mcdi_mon.c index b53de0d680..d0247dc44c 100644 --- a/drivers/net/sfc/base/mcdi_mon.c +++ b/drivers/net/sfc/base/mcdi_mon.c @@ -73,7 +73,8 @@ mcdi_mon_decode_stats( /* 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 */