[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/8] libelf: loop safety: Introduce elf_iter_ok and elf_strcmp_safe



Jan Beulich writes ("Re: [PATCH 1/8] libelf: loop safety: Introduce elf_iter_ok 
and elf_strcmp_safe"):
> Well, I have to confess that I've read the above as max() when
> in fact it is min().

Sadly we can't use min() and max() here it seems.

> On 12.12.16 at 17:00, <ian.jackson@xxxxxxxxxxxxx> wrote:
> > The max_size_for_deacc part is necessary because otherwise the
> > calculation "size * ELF_MAX_ITERATION_FACTOR" might overflow.  It
> > seems unreasonable to simply allow that overflow to occur.  But if it
> > is causing confusion we could do that.  The result would be a low
> > value for iteration_deaccumulator.
> 
> Considering that overflow here will actually result in a comparably
> smaller upper limit, I think this may help overall readability. But with
> the above I won't insist on this in any way.

I have replaced the limit with a comment.  Now I have:

    elf->iteration_deaccumulator =
        1024*1024 + size * ELF_MAX_ITERATION_FACTOR;        
        /* overflow (from very big size, probably rejected earlier)
         * would just lead to small limit, which is safe */

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.