* [PATCH] ARM(64): KVM: add signed type cast for comparation
@ 2013-07-22 3:20 Chen Gang
2013-07-30 2:51 ` Chen Gang
2013-07-30 3:45 ` Christoffer Dall
0 siblings, 2 replies; 4+ messages in thread
From: Chen Gang @ 2013-07-22 3:20 UTC (permalink / raw)
To: linux-arm-kernel
'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]
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ARM(64): KVM: add signed type cast for comparation
2013-07-22 3:20 [PATCH] ARM(64): KVM: add signed type cast for comparation Chen Gang
@ 2013-07-30 2:51 ` Chen Gang
2013-07-30 3:45 ` Christoffer Dall
1 sibling, 0 replies; 4+ messages in thread
From: Chen Gang @ 2013-07-30 2:51 UTC (permalink / raw)
To: linux-arm-kernel
Hello Maintainers:
Please help check the patch whether OK or not, when you have time.
Thanks.
On 07/22/2013 11:20 AM, 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]
>
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
> 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);
>
--
Chen Gang
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM(64): KVM: add signed type cast for comparation
2013-07-22 3:20 [PATCH] ARM(64): KVM: add signed type cast for comparation Chen Gang
2013-07-30 2:51 ` Chen Gang
@ 2013-07-30 3:45 ` Christoffer Dall
2013-07-30 4:07 ` Chen Gang
1 sibling, 1 reply; 4+ messages in thread
From: Christoffer Dall @ 2013-07-30 3:45 UTC (permalink / raw)
To: linux-arm-kernel
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@asianux.com>
> ---
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM(64): KVM: add signed type cast for comparation
2013-07-30 3:45 ` Christoffer Dall
@ 2013-07-30 4:07 ` Chen Gang
0 siblings, 0 replies; 4+ messages in thread
From: Chen Gang @ 2013-07-30 4:07 UTC (permalink / raw)
To: linux-arm-kernel
On 07/30/2013 11:45 AM, Christoffer Dall wrote:
> 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@asianux.com>
>> ---
>> 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.
>
Yeah, it is fine to me (better than my original fix).
Thanks.
--
Chen Gang
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-07-30 4:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-22 3:20 [PATCH] ARM(64): KVM: add signed type cast for comparation Chen Gang
2013-07-30 2:51 ` Chen Gang
2013-07-30 3:45 ` Christoffer Dall
2013-07-30 4:07 ` Chen Gang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox