Repository navigation
lib/alloc/: mallocarray(): Define as a macro - #1708
Draft
alejandro-colomar wants to merge 4 commits into
Draft
alejandro-colomar wants to merge 4 commits into
alejandro-colomar wants to merge 4 commits into
Conversation
alejandro-colomar
force-pushed
the
mallocarray
branch
from
July 31, 2026 14:07
f12c56e to
346adb2
Compare
alejandro-colomar
marked this pull request as draft
August 8, 2026 11:28
alejandro-colomar
force-pushed
the
mallocarray
branch
3 times, most recently
from
August 8, 2026 12:01
ca6bb08 to
3ad3afb
Compare
alejandro-colomar
force-pushed
the
mallocarray
branch
from
August 19, 2026 08:50
3ad3afb to
0f8412c
Compare
This was referenced Aug 23, 2026
alejandro-colomar
force-pushed
the
mallocarray
branch
from
August 24, 2026 11:40
0f8412c to
4c8ff1b
Compare
Draft
alejandro-colomar
force-pushed
the
mallocarray
branch
from
September 8, 2026 17:34
4c8ff1b to
563528c
Compare
alejandro-colomar
force-pushed
the
mallocarray
branch
from
September 16, 2026 22:32
563528c to
d81daae
Compare
This macro takes an lvalue, and performs lvalue conversion, resulting in an rvalue. Signed-off-by: Alejandro Colomar <alx@kernel.org>
This helps document that we're forcing lvalue conversion on purpose, for safety reasons. Signed-off-by: Alejandro Colomar <alx@kernel.org>
…sion Statement expressions are non-standard, and quite complex within the compiler, so it would be interesting to use simpler compiler features to achieve the same. The comma operator also performs lvalue conversion, and we can use a dummy (void)0 expression to introduce it. This is significantly simpler, and is more portable than the statement expression: it is valid all the way back to C99 (the comma operator and the (void)0 expression are portable to C89, but the compound literal is from C99). By using a simpler feature, we have a smaller risk of running into a compiler bug. Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88773> Suggested-by: Martin Uecker <uecker@tugraz.at> Cc: Christopher Bazley <chris.bazley@arm.com> Cc: Kees Cook <kees@kernel.org> Cc: Richard Russon <rich@flatcap.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
It's much simpler. Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar
force-pushed
the
mallocarray
branch
from
October 2, 2026 13:37
d81daae to
ffedc3f
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's much simpler.