Thread (24 messages) 24 messages, 4 authors, 2016-02-12

Re: [PATCH kernel v2 1/6] KVM: PPC: Rework H_PUT_TCE/H_GET_TCE handlers

From: Paul Mackerras <hidden>
Date: 2016-02-11 04:13:04
Also in: kvm

On Fri, Jan 22, 2016 at 12:59:47PM +1100, Alexey Kardashevskiy wrote:
On 01/22/2016 11:42 AM, David Gibson wrote:
quoted
On Thu, Jan 21, 2016 at 06:39:32PM +1100, Alexey Kardashevskiy wrote:
[snip]
quoted
quoted
+	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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help