[Bug 206749] Lack of checks on values in ELF headers in kernel linker

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Jan 29 22:05:55 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206749

--- Comment #1 from CTurt <cturt at hardenedbsd.org> ---
Actually, since `M_WAITOK` is specified for the allocations, the current thread
would theoretically sleep forever, whilst waiting for enough memory for the
allocation.

>From the man page (https://www.freebsd.org/cgi/man.cgi?query=malloc&sektion=9):

"The malloc(), realloc(), and reallocf() functions cannot return NULL if
M_WAITOK is specified."

So the check for this allocation being NULL is not needed:

        if ((shdr = malloc(nbytes, M_LINKER, M_WAITOK)) == NULL) {
                error = ENOMEM;
                goto out;
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list