Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit ff0a1124 authored by Alexander Potapenko's avatar Alexander Potapenko Committed by Greg Hackmann
Browse files

UPSTREAM: llist: clang: introduce member_address_is_nonnull()



Currently llist_for_each_entry() and llist_for_each_entry_safe() iterate
until &pos->member != NULL.  But when building the kernel with Clang,
the compiler assumes &pos->member cannot be NULL if the member's offset
is greater than 0 (which would be equivalent to the object being
non-contiguous in memory).  Therefore the loop condition is always true,
and the loops become infinite.

To work around this, introduce the member_address_is_nonnull() macro,
which casts object pointer to uintptr_t, thus letting the member pointer
to be NULL.

Signed-off-by: default avatarAlexander Potapenko <glider@google.com>
Tested-by: default avatarSodagudi Prasad <psodagud@codeaurora.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit beaec533fc2701a28a4d667f67c9f59c6e4e0d13)
parent e2b2ca94
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment