1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

macro: upgrade ref counting overflow check assert() → assert_se()

The overflow check for ref counting should not be subject to NDEBUG,
hence upgrade assert() → assert_se(). (The check for zero is an
immediate bug in our code, and should be impossible to trigger, hence
it's fine if the check is optimized away if people are crazy enough to
set NDEBUG, so that can stay assert())

https://github.com/systemd/systemd/pull/23099#discussion_r854341850
This commit is contained in:
Lennart Poettering 2022-04-20 22:10:43 +02:00 committed by Yu Watanabe
parent 55fc776bbc
commit 7d3e856e82

View File

@ -399,7 +399,7 @@ static inline int __coverity_check_and_return__(int condition) {
/* For type check. */ \
unsigned *q = &p->n_ref; \
assert(*q > 0); \
assert(*q < UINT_MAX); \
assert_se(*q < UINT_MAX); \
\
(*q)++; \
return p; \