diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-07-15 17:22:10 +0200 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2016-07-18 10:45:44 +1000 |
commit | b56d417b8d7548e913d928809ce6bb1d6c2563e2 (patch) | |
tree | aacb0097c7f8538a9841b7605a0b730883f18792 | |
parent | 28f3331887f9ae1fc19d2b9d7914047483442270 (diff) |
target-ppc: fix left shift overflow in hpte_page_shift
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>
-rw-r--r-- | target-ppc/mmu-hash64.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/target-ppc/mmu-hash64.c b/target-ppc/mmu-hash64.c index f6ffe35788..5de1358d1c 100644 --- 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; } } |