linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch: powerpc: kvm: add signed type cast for comparation
@ 2013-07-22  6:32 Chen Gang
  2013-07-30  2:56 ` Chen Gang
  2013-08-05  4:34 ` Paul Mackerras
  0 siblings, 2 replies; 5+ messages in thread
From: Chen Gang @ 2013-07-22  6:32 UTC (permalink / raw)
  To: Gleb Natapov, pbonzini, agraf, Benjamin Herrenschmidt, paulus
  Cc: linuxppc-dev, kvm-ppc, kvm

'rmls' is 'unsigned long', lpcr_rmls() will return negative number when
failure occurs, so it need a type cast for comparing.

'lpid' is 'unsigned long', kvmppc_alloc_lpid() return negative number
when failure occurs, so it need a type cast for comparing.


Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/powerpc/kvm/book3s_hv.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 2efa9dd..7629cd3 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -1809,7 +1809,7 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
 		rma_size <<= PAGE_SHIFT;
 		rmls = lpcr_rmls(rma_size);
 		err = -EINVAL;
-		if (rmls < 0) {
+		if ((long)rmls < 0) {
 			pr_err("KVM: Can't use RMA of 0x%lx bytes\n", rma_size);
 			goto out_srcu;
 		}
@@ -1874,7 +1874,7 @@ int kvmppc_core_init_vm(struct kvm *kvm)
 	/* Allocate the guest's logical partition ID */
 
 	lpid = kvmppc_alloc_lpid();
-	if (lpid < 0)
+	if ((long)lpid < 0)
 		return -ENOMEM;
 	kvm->arch.lpid = lpid;
 
-- 
1.7.7.6

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

* Re: [PATCH] arch: powerpc: kvm: add signed type cast for comparation
  2013-07-22  6:32 [PATCH] arch: powerpc: kvm: add signed type cast for comparation Chen Gang
@ 2013-07-30  2:56 ` Chen Gang
  2013-08-05  4:34 ` Paul Mackerras
  1 sibling, 0 replies; 5+ messages in thread
From: Chen Gang @ 2013-07-30  2:56 UTC (permalink / raw)
  To: Gleb Natapov, pbonzini, agraf, Benjamin Herrenschmidt, paulus
  Cc: linuxppc-dev, kvm-ppc, kvm

Hello Maintainers:

Please help check this patch whether OK or not, when you have time.

Thanks.

On 07/22/2013 02:32 PM, Chen Gang wrote:
> 'rmls' is 'unsigned long', lpcr_rmls() will return negative number when
> failure occurs, so it need a type cast for comparing.
> 
> 'lpid' is 'unsigned long', kvmppc_alloc_lpid() return negative number
> when failure occurs, so it need a type cast for comparing.
> 
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/powerpc/kvm/book3s_hv.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 2efa9dd..7629cd3 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -1809,7 +1809,7 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
>  		rma_size <<= PAGE_SHIFT;
>  		rmls = lpcr_rmls(rma_size);
>  		err = -EINVAL;
> -		if (rmls < 0) {
> +		if ((long)rmls < 0) {
>  			pr_err("KVM: Can't use RMA of 0x%lx bytes\n", rma_size);
>  			goto out_srcu;
>  		}
> @@ -1874,7 +1874,7 @@ int kvmppc_core_init_vm(struct kvm *kvm)
>  	/* Allocate the guest's logical partition ID */
>  
>  	lpid = kvmppc_alloc_lpid();
> -	if (lpid < 0)
> +	if ((long)lpid < 0)
>  		return -ENOMEM;
>  	kvm->arch.lpid = lpid;
>  
> 


-- 
Chen Gang

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

* Re: [PATCH] arch: powerpc: kvm: add signed type cast for comparation
  2013-07-22  6:32 [PATCH] arch: powerpc: kvm: add signed type cast for comparation Chen Gang
  2013-07-30  2:56 ` Chen Gang
@ 2013-08-05  4:34 ` Paul Mackerras
  2013-08-05  5:50   ` Chen Gang
  1 sibling, 1 reply; 5+ messages in thread
From: Paul Mackerras @ 2013-08-05  4:34 UTC (permalink / raw)
  To: Chen Gang; +Cc: Gleb Natapov, kvm, agraf, kvm-ppc, pbonzini, linuxppc-dev

On Mon, Jul 22, 2013 at 02:32:35PM +0800, Chen Gang wrote:
> 'rmls' is 'unsigned long', lpcr_rmls() will return negative number when
> failure occurs, so it need a type cast for comparing.
> 
> 'lpid' is 'unsigned long', kvmppc_alloc_lpid() return negative number
> when failure occurs, so it need a type cast for comparing.
> 
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>

Looks right, thanks.

Acked-by: Paul Mackerras <paulus@samba.org>

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

* Re: [PATCH] arch: powerpc: kvm: add signed type cast for comparation
  2013-08-05  4:34 ` Paul Mackerras
@ 2013-08-05  5:50   ` Chen Gang
  2013-08-28 14:24     ` Alexander Graf
  0 siblings, 1 reply; 5+ messages in thread
From: Chen Gang @ 2013-08-05  5:50 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Gleb Natapov, kvm, agraf, kvm-ppc, pbonzini, linuxppc-dev

On 08/05/2013 12:34 PM, Paul Mackerras wrote:
> On Mon, Jul 22, 2013 at 02:32:35PM +0800, Chen Gang wrote:
>> > 'rmls' is 'unsigned long', lpcr_rmls() will return negative number when
>> > failure occurs, so it need a type cast for comparing.
>> > 
>> > 'lpid' is 'unsigned long', kvmppc_alloc_lpid() return negative number
>> > when failure occurs, so it need a type cast for comparing.
>> > 
>> > 
>> > Signed-off-by: Chen Gang <gang.chen@asianux.com>
> Looks right, thanks.
> 
> Acked-by: Paul Mackerras <paulus@samba.org>
> 
> 

Thank you very much.

-- 
Chen Gang

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

* Re: [PATCH] arch: powerpc: kvm: add signed type cast for comparation
  2013-08-05  5:50   ` Chen Gang
@ 2013-08-28 14:24     ` Alexander Graf
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Graf @ 2013-08-28 14:24 UTC (permalink / raw)
  To: Chen Gang
  Cc: Gleb Natapov, kvm, kvm-ppc, Paul Mackerras, pbonzini, linuxppc-dev


On 05.08.2013, at 07:50, Chen Gang wrote:

> On 08/05/2013 12:34 PM, Paul Mackerras wrote:
>> On Mon, Jul 22, 2013 at 02:32:35PM +0800, Chen Gang wrote:
>>>> 'rmls' is 'unsigned long', lpcr_rmls() will return negative number when
>>>> failure occurs, so it need a type cast for comparing.
>>>> 
>>>> 'lpid' is 'unsigned long', kvmppc_alloc_lpid() return negative number
>>>> when failure occurs, so it need a type cast for comparing.
>>>> 
>>>> 
>>>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>> Looks right, thanks.
>> 
>> Acked-by: Paul Mackerras <paulus@samba.org>
>> 
>> 
> 
> Thank you very much.

Thanks, applied to kvm-ppc-queue.


Alex

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

end of thread, other threads:[~2013-08-28 14:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-22  6:32 [PATCH] arch: powerpc: kvm: add signed type cast for comparation Chen Gang
2013-07-30  2:56 ` Chen Gang
2013-08-05  4:34 ` Paul Mackerras
2013-08-05  5:50   ` Chen Gang
2013-08-28 14:24     ` Alexander Graf

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).