From: Mathieu Desnoyers Date: Tue, 20 Apr 2021 20:07:54 +0000 (-0400) Subject: Fix: hlist iteration relies on undefined behavior X-Git-Tag: v0.13.0~12 X-Git-Url: https://git.liburcu.org/?a=commitdiff_plain;ds=sidebyside;h=a0b5ef6802894441aae058f9a34628b565a35846;hp=a0b5ef6802894441aae058f9a34628b565a35846;p=urcu.git Fix: hlist iteration relies on undefined behavior Comparing an offset from an object with NULL is undefined behavior and the compiler may assume that this is never true. This is indeed what is observed with gcc-10 miscompiling cds_hlist_for_each_entry_rcu_2(). Fix this by introducing cds_hlist_entry_safe() rather than open-coding the NULL check comparisons, and move cds_hlist_for_each_entry_2() and cds_hlist_for_each_entry_safe_2() to this scheme as well. Fixes: #1308 Signed-off-by: Mathieu Desnoyers Change-Id: Ief3531cf04e54b6dae05eb28a6822adfa141fdeb ---