All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chen, Tiejun" <tiejun.chen@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] kvm: coalesced_mmio: remove one redundant check inside of coalesced_mmio_in_range()
Date: Fri, 12 Dec 2014 09:02:06 +0800	[thread overview]
Message-ID: <548A3E8E.7080609@intel.com> (raw)
In-Reply-To: <54897FFD.5030806@redhat.com>

On 2014/12/11 19:29, Paolo Bonzini wrote:
>
>
> On 11/12/2014 04:02, Tiejun Chen wrote:
>> We already check 'len' above to make sure it already isn't
>> negative here, so indeed, (addr + len < addr) should never be happened.
>
> ... except if there is an overflow.

Sorry, I'm confused. 'addr' is u64 and now 'len' would always be '>=0', 
what's your a so-called overflow here? And we also have such a check 
below, (addr + len > dev->zone.addr + dev->zone.size), so can this 
guarantee an overflow?

Thanks
Tiejun

>
> Paolo
>
>> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
>> ---
>>   virt/kvm/coalesced_mmio.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
>> index 00d8642..60f59cd 100644
>> --- a/virt/kvm/coalesced_mmio.c
>> +++ b/virt/kvm/coalesced_mmio.c
>> @@ -30,8 +30,6 @@ static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,
>>   	 */
>>   	if (len < 0)
>>   		return 0;
>> -	if (addr + len < addr)
>> -		return 0;
>>   	if (addr < dev->zone.addr)
>>   		return 0;
>>   	if (addr + len > dev->zone.addr + dev->zone.size)
>>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2014-12-12  1:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-11  3:02 [PATCH] kvm: coalesced_mmio: remove one redundant check inside of coalesced_mmio_in_range() Tiejun Chen
2014-12-11 11:29 ` Paolo Bonzini
2014-12-12  1:02   ` Chen, Tiejun [this message]
2014-12-12  1:24     ` Chen, Tiejun

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=548A3E8E.7080609@intel.com \
    --to=tiejun.chen@intel.com \
    --cc=kvm@vger.kernel.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.