[PATCH] malloc: Fix for infinite loop in memalign/posix_memalign.

Will Newton will.newton@linaro.org
Wed Oct 30 21:51:00 GMT 2013


On 30 October 2013 11:54, Carlos O'Donell <carlos@redhat.com> wrote:
> On 10/10/2013 08:26 AM, Will Newton wrote:
>> A very large alignment argument passed to mealign/posix_memalign
>> causes _int_memalign to enter an infinite loop. Limit the maximum
>> alignment value to the maximum representable power of two to
>> prevent this from happening.
>
> OK to checkin.

Thanks, applied.

> This looks good to me, adds tests with comments, and detects an
> invalid alignment which is required given the linux kernel man pages
> documentation.
>
> We still lack updated manual info for memalign and posix_memalign
> where we should be covering what is returned as valid errno values
> for these functions e.g. EINVAL and ENOMEM (that is to say that
> manual/memory.texi doesn't say that memalign and posix_memalign
> return any useful errors).

I've added that to my todo list.

-- 
Will Newton
Toolchain Working Group, Linaro



More information about the Libc-alpha mailing list