linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@ozlabs.org>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: David Gibson <david@gibson.dropbear.id.au>,
	linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org,
	kvm@vger.kernel.org
Subject: Re: [PATCH kernel v2 1/6] KVM: PPC: Rework H_PUT_TCE/H_GET_TCE handlers
Date: Thu, 11 Feb 2016 15:11:09 +1100	[thread overview]
Message-ID: <20160211041109.GA9757@oak.ozlabs.ibm.com> (raw)
In-Reply-To: <56A18D13.9050908@ozlabs.ru>

On Fri, Jan 22, 2016 at 12:59:47PM +1100, Alexey Kardashevskiy wrote:
> On 01/22/2016 11:42 AM, David Gibson wrote:
> >On Thu, Jan 21, 2016 at 06:39:32PM +1100, Alexey Kardashevskiy wrote:
[snip]
> >>+	if ((ioba & mask) || (idx + npages > size))
> >
> >It doesn't matter for the current callers, but you should check for
> >overflow in idx + npages as well.
> 
> 
> npages can be only 1..512 and this is checked in H_PUT_TCE/etc handlers.
> idx is 52bit long max.
> And this is not going to change because H_PUT_TCE_INDIRECT will always be
> limited by 512 (or one 4K page).
> 
> Do I still need the overflow check here?

You could add "|| npages > TCES_PER_PAGE" and that would make it clear
that there can't be any overflow, and it should get removed by the
compiler for the calls with constant npages.

Paul.

  parent reply	other threads:[~2016-02-11  4:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21  7:39 [PATCH kernel v2 0/6] KVM: PPC: Add in-kernel multitce handling Alexey Kardashevskiy
2016-01-21  7:39 ` [PATCH kernel v2 1/6] KVM: PPC: Rework H_PUT_TCE/H_GET_TCE handlers Alexey Kardashevskiy
2016-01-22  0:42   ` David Gibson
2016-01-22  1:59     ` Alexey Kardashevskiy
2016-01-24 23:43       ` David Gibson
2016-02-11  4:11       ` Paul Mackerras [this message]
2016-01-21  7:39 ` [PATCH kernel v2 2/6] KVM: PPC: Use RCU for arch.spapr_tce_tables Alexey Kardashevskiy
2016-01-24 23:46   ` David Gibson
2016-01-21  7:39 ` [PATCH kernel v2 3/6] KVM: PPC: Account TCE-containing pages in locked_vm Alexey Kardashevskiy
2016-01-24 23:57   ` David Gibson
2016-01-21  7:39 ` [PATCH kernel v2 4/6] KVM: PPC: Replace SPAPR_TCE_SHIFT with IOMMU_PAGE_SHIFT_4K Alexey Kardashevskiy
2016-01-21  7:39 ` [PATCH kernel v2 5/6] KVM: PPC: Move reusable bits of H_PUT_TCE handler to helpers Alexey Kardashevskiy
2016-01-25  0:12   ` David Gibson
2016-01-25  0:18     ` David Gibson
2016-02-11  4:39   ` Paul Mackerras
2016-01-21  7:39 ` [PATCH kernel v2 6/6] KVM: PPC: Add support for multiple-TCE hcalls Alexey Kardashevskiy
2016-01-21  7:56   ` kbuild test robot
2016-01-21  8:09     ` Alexey Kardashevskiy
2016-01-25  0:44   ` David Gibson
2016-01-25  1:24     ` Alexey Kardashevskiy
2016-01-25  5:21       ` David Gibson
2016-02-11  5:32   ` Paul Mackerras
2016-02-12  4:54     ` Alexey Kardashevskiy
2016-02-12  5:52       ` Paul Mackerras

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=20160211041109.GA9757@oak.ozlabs.ibm.com \
    --to=paulus@ozlabs.org \
    --cc=aik@ozlabs.ru \
    --cc=david@gibson.dropbear.id.au \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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).