From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH] x86/mmcfg: Fix initalisation of variables in pci_mmcfg_nvidia_mcp55()
Date: Wed, 3 Aug 2016 10:51:24 +0100 [thread overview]
Message-ID: <1470217884-16804-1-git-send-email-andrew.cooper3@citrix.com> (raw)
Shifting into the sign bit of an integer is undefined behaviour.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
I was experimenting with -fsanitise=undefined and this bit failed to compile,
as the initialisation became a non-constant expression.
---
xen/arch/x86/x86_64/mmconfig-shared.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c b/xen/arch/x86/x86_64/mmconfig-shared.c
index 742bc18..a7592c6 100644
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -182,10 +182,10 @@ static const char __init *pci_mmcfg_nvidia_mcp55(void)
int bus, i;
static const u32 extcfg_regnum = 0x90;
- static const u32 extcfg_enable_mask = 1<<31;
- static const u32 extcfg_start_mask = 0xff<<16;
+ static const u32 extcfg_enable_mask = 1u << 31;
+ static const u32 extcfg_start_mask = 0xffu << 16;
static const int extcfg_start_shift = 16;
- static const u32 extcfg_size_mask = 0x3<<28;
+ static const u32 extcfg_size_mask = 3u << 28;
static const int extcfg_size_shift = 28;
static const int extcfg_sizebus[] = {0xff, 0x7f, 0x3f, 0x1f};
static const u32 extcfg_base_mask[] = {0x7ff8, 0x7ffc, 0x7ffe, 0x7fff};
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next reply other threads:[~2016-08-03 9:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-03 9:51 Andrew Cooper [this message]
2016-08-03 10:24 ` [PATCH] x86/mmcfg: Fix initalisation of variables in pci_mmcfg_nvidia_mcp55() Jan Beulich
2016-08-03 11:03 ` Andrew Cooper
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=1470217884-16804-1-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.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).