From: Lennart Poettering Date: Wed, 20 Apr 2022 20:10:43 +0000 (+0200) Subject: macro: upgrade ref counting overflow check assert() → assert_se() X-Git-Tag: v251-rc2~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d3e856e824ce54f8e768df3ffde2b25c8c21d1d;p=thirdparty%2Fsystemd.git 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 --- diff --git a/src/basic/macro.h b/src/basic/macro.h index 6e3966ff486..3bf982803d5 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -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; \