All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Gleb Natapov <gleb@redhat.com>,
	pbonzini@redhat.com, agraf@suse.de,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	"paulus@samba.org" <paulus@samba.org>
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH] arch: powerpc: kvm: add signed type cast for comparation
Date: Tue, 30 Jul 2013 02:56:16 +0000	[thread overview]
Message-ID: <51F72B50.2050404@asianux.com> (raw)
In-Reply-To: <51ECD203.9050507@asianux.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Chen Gang <gang.chen@asianux.com>
To: Gleb Natapov <gleb@redhat.com>,
	pbonzini@redhat.com, agraf@suse.de,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	"paulus@samba.org" <paulus@samba.org>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] arch: powerpc: kvm: add signed type cast for comparation
Date: Tue, 30 Jul 2013 10:56:16 +0800	[thread overview]
Message-ID: <51F72B50.2050404@asianux.com> (raw)
In-Reply-To: <51ECD203.9050507@asianux.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Chen Gang <gang.chen@asianux.com>
To: Gleb Natapov <gleb@redhat.com>,
	pbonzini@redhat.com, agraf@suse.de,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	"paulus@samba.org" <paulus@samba.org>
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH] arch: powerpc: kvm: add signed type cast for comparation
Date: Tue, 30 Jul 2013 10:56:16 +0800	[thread overview]
Message-ID: <51F72B50.2050404@asianux.com> (raw)
In-Reply-To: <51ECD203.9050507@asianux.com>

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

  reply	other threads:[~2013-07-30  2:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22  6:32 [PATCH] arch: powerpc: kvm: add signed type cast for comparation Chen Gang
2013-07-22  6:32 ` Chen Gang
2013-07-22  6:32 ` Chen Gang
2013-07-30  2:56 ` Chen Gang [this message]
2013-07-30  2:56   ` Chen Gang
2013-07-30  2:56   ` Chen Gang
2013-08-05  4:34 ` Paul Mackerras
2013-08-05  4:34   ` Paul Mackerras
2013-08-05  4:34   ` Paul Mackerras
2013-08-05  5:50   ` Chen Gang
2013-08-05  5:50     ` Chen Gang
2013-08-05  5:50     ` Chen Gang
2013-08-28 14:24     ` Alexander Graf
2013-08-28 14:24       ` Alexander Graf
2013-08-28 14:24       ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51F72B50.2050404@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=agraf@suse.de \
    --cc=benh@kernel.crashing.org \
    --cc=gleb@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.