From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: benh@kernel.crashing.org, paulus@samba.org, agraf@suse.de
Cc: linuxppc-dev@lists.ozlabs.org,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
kvm-ppc@vger.kernel.org
Subject: [PATCH] powerpc/kvm: Handle the boundary condition correctly
Date: Thu, 22 Aug 2013 17:07:59 +0530 [thread overview]
Message-ID: <1377171479-25738-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> (raw)
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
We should be able to copy upto count bytes
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
next reply other threads:[~2013-08-22 11:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-22 11:37 Aneesh Kumar K.V [this message]
2013-08-22 16:48 ` [PATCH] powerpc/kvm: Handle the boundary condition correctly Alexander Graf
2013-08-23 3:31 ` Aneesh Kumar K.V
2013-08-23 4:28 ` Benjamin Herrenschmidt
2013-08-25 18:09 ` Alexander Graf
2013-08-25 18:16 ` Alexander Graf
2013-08-26 3:28 ` Aneesh Kumar K.V
2013-08-26 11:10 ` Alexander Graf
2013-08-26 12:14 ` Aneesh Kumar K.V
2013-09-25 15:42 ` Aneesh Kumar K.V
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=1377171479-25738-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=benh@kernel.crashing.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).