Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jan 2016 22:05:55 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 206749] Lack of checks on values in ELF headers in kernel linker
Message-ID:  <bug-206749-8-jRULIV1Mem@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-206749-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-206749-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206749

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

>From the man page (https://www.freebsd.org/cgi/man.cgi?query=3Dmalloc&sekti=
on=3D9):

"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 =3D malloc(nbytes, M_LINKER, M_WAITOK)) =3D=3D NULL) {
                error =3D ENOMEM;
                goto out;
        }

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-206749-8-jRULIV1Mem>