* [patch] x86/apic/uv: silence a shift wrapping warning
@ 2016-11-23 22:19 Dan Carpenter
2016-11-24 6:25 ` [tip:x86/urgent] x86/apic/uv: Silence " tip-bot for Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2016-11-23 22:19 UTC (permalink / raw)
To: Thomas Gleixner, Mike Travis
Cc: Ingo Molnar, H. Peter Anvin, x86, Dimitri Sivanich,
Nathan Zimmer, Alex Thorlton, Sebastian Andrzej Siewior,
linux-kernel, kernel-janitors
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.
Fixes: b15cc4a12bed ("x86, uv, uv3: Update x2apic Support for SGI UV3")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Please review this one, carefully because I'm not positive about it.
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index aeef53c..35690a1 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -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)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [tip:x86/urgent] x86/apic/uv: Silence a shift wrapping warning
2016-11-23 22:19 [patch] x86/apic/uv: silence a shift wrapping warning Dan Carpenter
@ 2016-11-24 6:25 ` tip-bot for Dan Carpenter
2016-11-29 21:06 ` Alex Thorlton
0 siblings, 1 reply; 3+ messages in thread
From: tip-bot for Dan Carpenter @ 2016-11-24 6:25 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, travis, nzimmer, mingo, dan.carpenter, sivanich,
tglx, torvalds, peterz, bigeasy, athorlton, hpa
Commit-ID: c4597fd756836a5fb7900f2091797ab564390ad0
Gitweb: http://git.kernel.org/tip/c4597fd756836a5fb7900f2091797ab564390ad0
Author: Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate: Thu, 24 Nov 2016 01:19:08 +0300
Committer: Ingo Molnar <mingo@kernel.org>
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.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Alex Thorlton <athorlton@sgi.com>
Cc: Dimitri Sivanich <sivanich@sgi.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Travis <travis@sgi.com>
Cc: Nathan Zimmer <nzimmer@sgi.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kernel-janitors@vger.kernel.org
Fixes: b15cc4a12bed ("x86, uv, uv3: Update x2apic Support for SGI UV3")
Link: http://lkml.kernel.org/r/20161123221908.GA23997@mwanda
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/apic/x2apic_uv_x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index aeef53c..35690a1 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -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)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [tip:x86/urgent] x86/apic/uv: Silence a shift wrapping warning
2016-11-24 6:25 ` [tip:x86/urgent] x86/apic/uv: Silence " tip-bot for Dan Carpenter
@ 2016-11-29 21:06 ` Alex Thorlton
0 siblings, 0 replies; 3+ messages in thread
From: Alex Thorlton @ 2016-11-29 21:06 UTC (permalink / raw)
To: dan.carpenter, mingo, nzimmer, linux-kernel, travis, tglx, hpa,
bigeasy, athorlton, torvalds, peterz, sivanich
Cc: linux-tip-commits
On Wed, Nov 23, 2016 at 10:25:48PM -0800, tip-bot for Dan Carpenter wrote:
> Commit-ID: c4597fd756836a5fb7900f2091797ab564390ad0
> Gitweb: http://git.kernel.org/tip/c4597fd756836a5fb7900f2091797ab564390ad0
> Author: Dan Carpenter <dan.carpenter@oracle.com>
> AuthorDate: Thu, 24 Nov 2016 01:19:08 +0300
> Committer: Ingo Molnar <mingo@kernel.org>
> 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Alex Thorlton <athorlton@sgi.com>
Acked-by: Alex Thorlton <athorlton@sgi.com>
- Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-29 21:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-23 22:19 [patch] x86/apic/uv: silence a shift wrapping warning Dan Carpenter
2016-11-24 6:25 ` [tip:x86/urgent] x86/apic/uv: Silence " tip-bot for Dan Carpenter
2016-11-29 21:06 ` Alex Thorlton
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).