Re: [PATCH] mm/gup_benchmark: prevent integer overflow in ioctl

William Kucharski
2018-11-01T08:28:55Z

> On Nov 1, 2018, at 1:16 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> My patch lets people allocate 4MB. (U32_MAX / 4096 * sizeof(void *)).
> Surely, that's enough? I liked my check because it avoids the divide so
> it's faster and it is a no-op on 64bit systems.

It should be enough, and you're right, it does avoid extra math.

However, in that case I'd like to see a comment added so that anyone looking
at the code in the future knows why you limited the allocation to ULONG_MAX
bytes.

Thanks,
William Kucharski