All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: e500: fix couple of shift operations on 64 bits
@ 2015-10-01 12:58 ` Laurentiu Tudor
  0 siblings, 0 replies; 6+ messages in thread
From: Laurentiu Tudor @ 2015-10-01 12:58 UTC (permalink / raw)
  To: kvm-ppc, kvm; +Cc: Laurentiu Tudor, Scott Wood, Alexander Graf

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>
---
 arch/powerpc/kvm/e500_mmu_host.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
index 008ab84..a096cf9 100644
--- a/arch/powerpc/kvm/e500_mmu_host.c
+++ b/arch/powerpc/kvm/e500_mmu_host.c
@@ -418,7 +418,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
 			for (; tsize > BOOK3E_PAGESZ_4K;
 			     tsize -= tsize_inc) {
 				unsigned long gfn_start, gfn_end;
-				tsize_pages = 1 << (tsize - 2);
+				tsize_pages = 1UL << (tsize - 2);
 
 				gfn_start = gfn & ~(tsize_pages - 1);
 				gfn_end = gfn_start + tsize_pages;
@@ -462,7 +462,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
 	}
 
 	if (likely(!pfnmap)) {
-		tsize_pages = 1 << (tsize + 10 - PAGE_SHIFT);
+		tsize_pages = 1UL << (tsize + 10 - PAGE_SHIFT);
 		pfn = gfn_to_pfn_memslot(slot, gfn);
 		if (is_error_noslot_pfn(pfn)) {
 			if (printk_ratelimit())
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] KVM: PPC: e500: fix couple of shift operations on 64 bits
@ 2015-10-01 12:58 ` Laurentiu Tudor
  0 siblings, 0 replies; 6+ messages in thread
From: Laurentiu Tudor @ 2015-10-01 12:58 UTC (permalink / raw)
  To: kvm-ppc, kvm; +Cc: Laurentiu Tudor, Scott Wood, Alexander Graf

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>
---
 arch/powerpc/kvm/e500_mmu_host.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
index 008ab84..a096cf9 100644
--- a/arch/powerpc/kvm/e500_mmu_host.c
+++ b/arch/powerpc/kvm/e500_mmu_host.c
@@ -418,7 +418,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
 			for (; tsize > BOOK3E_PAGESZ_4K;
 			     tsize -= tsize_inc) {
 				unsigned long gfn_start, gfn_end;
-				tsize_pages = 1 << (tsize - 2);
+				tsize_pages = 1UL << (tsize - 2);
 
 				gfn_start = gfn & ~(tsize_pages - 1);
 				gfn_end = gfn_start + tsize_pages;
@@ -462,7 +462,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
 	}
 
 	if (likely(!pfnmap)) {
-		tsize_pages = 1 << (tsize + 10 - PAGE_SHIFT);
+		tsize_pages = 1UL << (tsize + 10 - PAGE_SHIFT);
 		pfn = gfn_to_pfn_memslot(slot, gfn);
 		if (is_error_noslot_pfn(pfn)) {
 			if (printk_ratelimit())
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: PPC: e500: fix couple of shift operations on 64 bits
  2015-10-01 12:58 ` Laurentiu Tudor
@ 2015-10-01 16:52   ` Scott Wood
  -1 siblings, 0 replies; 6+ messages in thread
From: Scott Wood @ 2015-10-01 16:52 UTC (permalink / raw)
  To: Laurentiu Tudor; +Cc: kvm-ppc, kvm, Laurentiu Tudor, Alexander Graf

On Thu, 2015-10-01 at 15:58 +0300, Laurentiu Tudor wrote:
> 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>
> ---
>  arch/powerpc/kvm/e500_mmu_host.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Scott Wood <scottwood@freescale.com>

-Scott


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: PPC: e500: fix couple of shift operations on 64 bits
@ 2015-10-01 16:52   ` Scott Wood
  0 siblings, 0 replies; 6+ messages in thread
From: Scott Wood @ 2015-10-01 16:52 UTC (permalink / raw)
  To: Laurentiu Tudor; +Cc: kvm-ppc, kvm, Laurentiu Tudor, Alexander Graf

On Thu, 2015-10-01 at 15:58 +0300, Laurentiu Tudor wrote:
> 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>
> ---
>  arch/powerpc/kvm/e500_mmu_host.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Scott Wood <scottwood@freescale.com>

-Scott


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: PPC: e500: fix couple of shift operations on 64 bits
  2015-10-01 12:58 ` Laurentiu Tudor
@ 2015-10-15  5:31   ` Paul Mackerras
  -1 siblings, 0 replies; 6+ messages in thread
From: Paul Mackerras @ 2015-10-15  5:31 UTC (permalink / raw)
  To: Laurentiu Tudor; +Cc: kvm-ppc, kvm, Laurentiu Tudor, Scott Wood, Alexander Graf

On Thu, Oct 01, 2015 at 03:58:03PM +0300, Laurentiu Tudor wrote:
> 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>

Thanks, applied to my kvm-ppc-next branch.

Paul.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: PPC: e500: fix couple of shift operations on 64 bits
@ 2015-10-15  5:31   ` Paul Mackerras
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Mackerras @ 2015-10-15  5:31 UTC (permalink / raw)
  To: Laurentiu Tudor; +Cc: kvm-ppc, kvm, Laurentiu Tudor, Scott Wood, Alexander Graf

On Thu, Oct 01, 2015 at 03:58:03PM +0300, Laurentiu Tudor wrote:
> 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>

Thanks, applied to my kvm-ppc-next branch.

Paul.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-15  5:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-01 12:58 [PATCH] KVM: PPC: e500: fix couple of shift operations on 64 bits Laurentiu Tudor
2015-10-01 12:58 ` Laurentiu Tudor
2015-10-01 16:52 ` Scott Wood
2015-10-01 16:52   ` Scott Wood
2015-10-15  5:31 ` Paul Mackerras
2015-10-15  5:31   ` Paul Mackerras

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.