Skip to content

Commit 224f363

Browse files
Tudor Laurentiupaulusmack
authored andcommitted
KVM: PPC: e500: fix couple of shift operations on 64 bits
Fix couple of cases where we shift left a 32-bit value thus might get truncated results on 64-bit targets. Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com> Suggested-by: Scott Wood <scotttwood@freescale.com> Acked-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
1 parent 2daab50 commit 224f363

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/powerpc/kvm/e500_mmu_host.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
406406

407407
for (; tsize > BOOK3E_PAGESZ_4K; tsize -= 2) {
408408
unsigned long gfn_start, gfn_end;
409-
tsize_pages = 1 << (tsize - 2);
409+
tsize_pages = 1UL << (tsize - 2);
410410

411411
gfn_start = gfn & ~(tsize_pages - 1);
412412
gfn_end = gfn_start + tsize_pages;
@@ -447,7 +447,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
447447
}
448448

449449
if (likely(!pfnmap)) {
450-
tsize_pages = 1 << (tsize + 10 - PAGE_SHIFT);
450+
tsize_pages = 1UL << (tsize + 10 - PAGE_SHIFT);
451451
pfn = gfn_to_pfn_memslot(slot, gfn);
452452
if (is_error_noslot_pfn(pfn)) {
453453
if (printk_ratelimit())

0 commit comments

Comments
 (0)