All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Alexander Graf <agraf@suse.de>
Cc: paulus@samba.org, linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org
Subject: Re: [PATCH] powerpc/kvm: Handle the boundary condition correctly
Date: Fri, 23 Aug 2013 03:43:41 +0000	[thread overview]
Message-ID: <87haeh13s2.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <1683D101-052D-4BEB-8ED1-6F32C6904850@suse.de>

Alexander Graf <agraf@suse.de> writes:

> On 22.08.2013, at 12:37, Aneesh Kumar K.V wrote:
>
>> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
>
> Isn't this you?

Yes. The patches are generated using git format-patch and sent by
git send-email. That's how it always created patches for me. I am not sure if
there is a config I can change to avoid having From:

>
>> 
>> We should be able to copy upto count bytes
>
> Why?
>

Without this we end up doing

 +    struct kvm_get_htab_buf {
 +        struct kvm_get_htab_header header;
 +        /*
 +         * Older kernel required one extra byte.
 +         */
 +        unsigned long hpte[3];
 +    } hpte_buf;


even though we are only looking for one hpte entry.

http://mid.gmane.org/1376995766-16526-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com

>
> Alex
>
>> 
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>> ---
>> arch/powerpc/kvm/book3s_64_mmu_hv.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
>> index 710d313..0ae6bb6 100644
>> --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
>> +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
>> @@ -1362,7 +1362,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf,
>> 	lbuf = (unsigned long __user *)buf;
>> 
>> 	nb = 0;
>> -	while (nb + sizeof(hdr) + HPTE_SIZE < count) {
>> +	while (nb + sizeof(hdr) + HPTE_SIZE <= count) {
>> 		/* Initialize header */
>> 		hptr = (struct kvm_get_htab_header __user *)buf;
>> 		hdr.n_valid = 0;
>> @@ -1385,7 +1385,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf,
>> 		/* Grab a series of valid entries */
>> 		while (i < kvm->arch.hpt_npte &&
>> 		       hdr.n_valid < 0xffff &&
>> -		       nb + HPTE_SIZE < count &&
>> +		       nb + HPTE_SIZE <= count &&
>> 		       record_hpte(flags, hptp, hpte, revp, 1, first_pass)) {
>> 			/* valid entry, write it out */
>> 			++hdr.n_valid;
>> -- 
>> 1.8.1.2
>> 


WARNING: multiple messages have this Message-ID (diff)
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Alexander Graf <agraf@suse.de>
Cc: paulus@samba.org, linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org
Subject: Re: [PATCH] powerpc/kvm: Handle the boundary condition correctly
Date: Fri, 23 Aug 2013 09:01:41 +0530	[thread overview]
Message-ID: <87haeh13s2.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <1683D101-052D-4BEB-8ED1-6F32C6904850@suse.de>

Alexander Graf <agraf@suse.de> writes:

> On 22.08.2013, at 12:37, Aneesh Kumar K.V wrote:
>
>> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
>
> Isn't this you?

Yes. The patches are generated using git format-patch and sent by
git send-email. That's how it always created patches for me. I am not sure if
there is a config I can change to avoid having From:

>
>> 
>> We should be able to copy upto count bytes
>
> Why?
>

Without this we end up doing

 +    struct kvm_get_htab_buf {
 +        struct kvm_get_htab_header header;
 +        /*
 +         * Older kernel required one extra byte.
 +         */
 +        unsigned long hpte[3];
 +    } hpte_buf;


even though we are only looking for one hpte entry.

http://mid.gmane.org/1376995766-16526-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com

>
> Alex
>
>> 
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>> ---
>> arch/powerpc/kvm/book3s_64_mmu_hv.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
>> index 710d313..0ae6bb6 100644
>> --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
>> +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
>> @@ -1362,7 +1362,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf,
>> 	lbuf = (unsigned long __user *)buf;
>> 
>> 	nb = 0;
>> -	while (nb + sizeof(hdr) + HPTE_SIZE < count) {
>> +	while (nb + sizeof(hdr) + HPTE_SIZE <= count) {
>> 		/* Initialize header */
>> 		hptr = (struct kvm_get_htab_header __user *)buf;
>> 		hdr.n_valid = 0;
>> @@ -1385,7 +1385,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf,
>> 		/* Grab a series of valid entries */
>> 		while (i < kvm->arch.hpt_npte &&
>> 		       hdr.n_valid < 0xffff &&
>> -		       nb + HPTE_SIZE < count &&
>> +		       nb + HPTE_SIZE <= count &&
>> 		       record_hpte(flags, hptp, hpte, revp, 1, first_pass)) {
>> 			/* valid entry, write it out */
>> 			++hdr.n_valid;
>> -- 
>> 1.8.1.2
>> 

  reply	other threads:[~2013-08-23  3:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-22 11:37 [PATCH] powerpc/kvm: Handle the boundary condition correctly Aneesh Kumar K.V
2013-08-22 11:49 ` Aneesh Kumar K.V
2013-08-22 16:48 ` Alexander Graf
2013-08-22 16:48   ` Alexander Graf
2013-08-23  3:31   ` Aneesh Kumar K.V [this message]
2013-08-23  3:43     ` Aneesh Kumar K.V
2013-08-23  4:28     ` Benjamin Herrenschmidt
2013-08-23  4:28       ` Benjamin Herrenschmidt
2013-08-25 18:09       ` Alexander Graf
2013-08-25 18:09         ` Alexander Graf
2013-08-25 18:16     ` Alexander Graf
2013-08-25 18:16       ` Alexander Graf
2013-08-26  3:28       ` Aneesh Kumar K.V
2013-08-26  3:40         ` Aneesh Kumar K.V
2013-08-26 11:10         ` Alexander Graf
2013-08-26 11:10           ` Alexander Graf
2013-08-26 12:14           ` Aneesh Kumar K.V
2013-08-26 12:26             ` Aneesh Kumar K.V
2013-09-25 15:42             ` Aneesh Kumar K.V
2013-09-25 15:54               ` Aneesh Kumar K.V
2013-09-25 15:51               ` Alexander Graf
2013-09-25 15:51                 ` Alexander Graf
  -- strict thread matches above, loose matches on Subject: below --
2013-08-11 18:20 Aneesh Kumar K.V

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=87haeh13s2.fsf@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    /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.