x86/mmcfg: Fix initalisation of variables in pci_mmcfg_nvidia_mcp55()
PATCH 1/1 x86/mmcfg: Fix initalisation of variables in pci_mmcfg_nvidia_mcp55()
Shifting into the sign bit of an integer is undefined behaviour.
---
CC: Jan Beulich <[email protected]>
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(-)
xen/arch/x86/x86_64/mmconfig-shared.c +3 -3
@@ -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 };
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
xen/arch/x86/x86_64/mmconfig-shared.c static const char __init *pci_mmcfg_nvidia_mcp55(void) · line 185
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 03.08.16 at 11:51, <[email protected]> wrote:
xen/arch/x86/x86_64/mmconfig-shared.c +1
-2@@ -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 ;
Aiui only this one change is really related to the patch subject; the other two I suppose you just alter for consistency? Anyway,
Quoted 9 lines
xen/arch/x86/x86_64/mmconfig-shared.c +2
-1+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 };Signature · 1 line
2.1.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 03.08.16 at 11:51, <[email protected]> wrote:
xen/arch/x86/x86_64/mmconfig-shared.c +0
-0@@ -182,10 +182,10 @@ static const char __init *pci_mmcfg_nvidia_mcp55(void)int bus, i;
Quoted 7 lines
xen/arch/x86/x86_64/mmconfig-shared.c static const char __init *pci_mmcfg_nvidia_mcp55(void) · line 185
Quoted 4 lines
xen/arch/x86/x86_64/mmconfig-shared.c +1
-2static 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 ;Aiui only this one change is really related to the patch subject; the other two I suppose you just alter for consistency? Anyway,
Acked-by Jan Beulich <[email protected]>
Indeed.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel