x86/apic/uv: silence a shift wrapping warning
Subsystems (3)
PATCH 1/1 x86/apic/uv: silence a shift wrapping warning
m_io is stored in 6 bits so it's a number in the 0-63 range. Static analysis tools complain that 1 << 63 will wrap so I have changed it to 1ULL << m_io.
This code is over three years old so presumably the bug doesn't happen very frequently in real life or someone would have complained by now.
---
Please review this one, carefully because I'm not positive about it.
arch/x86/kernel/apic/x2apic_uv_x.c +2 -2
@@ -815,9 +815,9 @@ static __init void map_mmioh_high_uv3(int index, int min_pnode, int max_pnode) l = li; } addr1 = (base << shift) + - f * (unsigned long )(1 << m_io); + f * (1ULL << m_io); addr2 = (base << shift) + - (l +1 ) * (unsigned long )(1 << m_io); + (l +1 ) * (1ULL << m_io);pr_info ("UV: %s[%03d..%03d] NASID 0x%04x ADDR 0x%016lx - 0x%016lx\n" , id, fi, li, lnasid, addr1, addr2);if (max_io < l)
tip-bot for Dan Carpenter
merge bot[tip:x86/urgent] x86/apic/uv: Silence a shift wrapping warning
x86/apic/uv: Silence a shift wrapping warning
Commit-ID: c4597fd756836a5fb7900f2091797ab564390ad0 Gitweb: http://git.kernel.org/tip/c4597fd756836a5fb7900f2091797ab564390ad0 Author: Dan Carpenter <[email protected]> AuthorDate: Thu, 24 Nov 2016 01:19:08 +0300 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 24 Nov 2016 06:01:05 +0100
x86/apic/uv: Silence a shift wrapping warning
'm_io' is stored in 6 bits so it's a number in the 0-63 range. Static analysis tools complain that 1 << 63 will wrap so I have changed it to 1ULL << m_io.
This code is over three years old so presumably the bug doesn't happen very frequently in real life or someone would have complained by now.
--- arch/x86/kernel/apic/x2apic_uv_x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/apic/x2apic_uv_x.c +2 -2
@@ -815,9 +815,9 @@ static __init void map_mmioh_high_uv3(int index, int min_pnode, int max_pnode) l = li; } addr1 = (base << shift) + - f * (unsigned long )(1 << m_io); + f * (1ULL << m_io); addr2 = (base << shift) + - (l +1 ) * (unsigned long )(1 << m_io); + (l +1 ) * (1ULL << m_io);pr_info ("UV: %s[%03d..%03d] NASID 0x%04x ADDR 0x%016lx - 0x%016lx\n" , id, fi, li, lnasid, addr1, addr2);if (max_io < l)
Alex Thorlton
Acked-byRe: [tip:x86/urgent] x86/apic/uv: Silence a shift wrapping warning
Quoted 13 lines · tip-bot for Dan Carpenter
Commit-ID: c4597fd756836a5fb7900f2091797ab564390ad0 Gitweb: http://git.kernel.org/tip/c4597fd756836a5fb7900f2091797ab564390ad0 Author: Dan Carpenter <[email protected]> AuthorDate: Thu, 24 Nov 2016 01:19:08 +0300 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 24 Nov 2016 06:01:05 +0100x86/apic/uv: Silence a shift wrapping warning
'
m_io' is stored in 6 bits so it's a number in the 0-63 range. Static analysis tools complain that 1 << 63 will wrap so I have changed it to 1ULL <<m_io.
Quoted 5 lines
This code is over three years old so presumably the bug doesn't happen very frequently in real life or someone would have complained by now.
Signed-off-by Dan Carpenter <[email protected]>Cc Alex Thorlton <[email protected]>
- Alex