Re: [PATCH] ARM(64): KVM: add signed type cast for comparation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 22, 2013 at 11:20:12AM +0800, Chen Gang wrote:
> 'len' is 'unsigned long' which is never less than zero.
> 
> So need a related type cast for comparation.
> 
> The related warning (when building ARM64 with allmodconfig):
> 
>   arch/arm64/kvm/../../../arch/arm/kvm/mmio.c:82:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
> 

Hmmm, interesting, I don't get this error with my compiler.

> 
> Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
> ---
>  arch/arm/kvm/mmio.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
> index b8e06b7..626dfc8 100644
> --- a/arch/arm/kvm/mmio.c
> +++ b/arch/arm/kvm/mmio.c
> @@ -79,7 +79,7 @@ static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
>  	}
>  
>  	len = kvm_vcpu_dabt_get_as(vcpu);
> -	if (unlikely(len < 0))
> +	if (unlikely((long)len < 0))
>  		return len;
>  
>  	is_write = kvm_vcpu_dabt_iswrite(vcpu);
> -- 
> 1.7.7.6

I think the proper fix is to declare len as an int instead.  I'll queue
that instead.

Thanks,
-Christoffer
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux