mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
macro: check over flow in reference counter
This commit is contained in:
parent
6dd18b34cf
commit
c8431e9e35
@ -396,8 +396,12 @@ static inline int __coverity_check_and_return__(int condition) {
|
||||
if (!p) \
|
||||
return NULL; \
|
||||
\
|
||||
assert(p->n_ref > 0); \
|
||||
p->n_ref++; \
|
||||
/* For type check. */ \
|
||||
unsigned *q = &p->n_ref; \
|
||||
assert(*q > 0); \
|
||||
assert(*q < UINT_MAX); \
|
||||
\
|
||||
(*q)++; \
|
||||
return p; \
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user