From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Mark Spender <mspender@solarflare.com>, <stable@dpdk.org>
Subject: [dpdk-stable] [PATCH 03/29] net/sfc/base: fix shift by more bits than field width
Date: Mon, 10 Jun 2019 08:38:18 +0100 [thread overview]
Message-ID: <1560152324-20538-4-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1560152324-20538-1-git-send-email-arybchenko@solarflare.com>
From: Mark Spender <mspender@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@dpdk.org
Signed-off-by: Mark Spender <mspender@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@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
prev parent reply other threads:[~2019-06-10 7:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1560152324-20538-1-git-send-email-arybchenko@solarflare.com>
2019-06-10 7:38 ` [dpdk-stable] [PATCH 01/29] net/sfc/base: enable chained multicast on all EF10 cards Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-stable] [PATCH 02/29] net/sfc/base: fix signed/unsigned mismatch errors Andrew Rybchenko
2019-06-10 7:38 ` Andrew Rybchenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1560152324-20538-4-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=mspender@solarflare.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).