arch: powerpc: kvm: add signed type cast for comparation
Subsystems (3)
PATCH 1/1 arch: powerpc: kvm: add signed type cast for comparation
'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.
--- arch/powerpc/kvm/book3s_hv.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_hv.c +2 -2
@@ -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;
Signature · 1 line
1.7.7.6
Hello Maintainers:
Please help check this patch whether OK or not, when you have time.
Thanks.
Quoted 35 lines · Chen Gang
'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 <[email protected]>--- arch/powerpc/kvm/book3s_hv.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)arch/powerpc/kvm/book3s_hv.c +2
-2@@ -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;
Signature · 1 line
Chen Gang
Quoted 8 lines · Chen Gang
'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 <[email protected]>
Looks right, thanks.
Quoted 4 lines · Paul Mackerras
Quoted 3 lines · Chen Gang
Quoted 3 lines
'rmls' is 'unsigned long',
lpcr_rmls()will return negative number when failure occurs, so it need a type cast for comparing.
Quoted 10 lines
Quoted 5 lines
Quoted 5 lines
'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 <[email protected]>Looks right, thanks.
Acked-by Paul Mackerras <[email protected]>
Thank you very much.
Signature · 1 line
Chen Gang
Alexander Graf
AppliedQuoted 9 lines · Chen Gang
Quoted 8 lines · Paul Mackerras
Quoted 7 lines · Chen Gang
Quoted 7 lines
'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.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Chen Gang <[email protected]>Looks right, thanks.
Acked-by Paul Mackerras <[email protected]>Thank you very much.
Thanks, applied to kvm-ppc-queue.
Alex