projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
28f3331
)
target-ppc: fix left shift overflow in hpte_page_shift
author
Paolo Bonzini
<pbonzini@redhat.com>
Fri, 15 Jul 2016 15:22:10 +0000
(17:22 +0200)
committer
David Gibson
<david@gibson.dropbear.id.au>
Mon, 18 Jul 2016 00:45:44 +0000
(10:45 +1000)
ps->pte_enc is a 32-bit value, which is shifted left and then compared
to a 64-bit value. It needs a cast before the shift.
Reported by Coverity.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
target-ppc/mmu-hash64.c
patch
|
blob
|
history
diff --git
a/target-ppc/mmu-hash64.c
b/target-ppc/mmu-hash64.c
index f6ffe35788d7bc1c90113e456627684730687cf0..5de1358d1cfa1dc9b54c42d34883be827ea2e7ae 100644
(file)
--- a/
target-ppc/mmu-hash64.c
+++ b/
target-ppc/mmu-hash64.c
@@
-478,7
+478,7
@@
static unsigned hpte_page_shift(const struct ppc_one_seg_page_size *sps,
mask = ((1ULL << ps->page_shift) - 1) & HPTE64_R_RPN;
- if ((pte1 & mask) == (ps->pte_enc << HPTE64_R_RPN_SHIFT)) {
+ if ((pte1 & mask) == (
(uint64_t)
ps->pte_enc << HPTE64_R_RPN_SHIFT)) {
return ps->page_shift;
}
}