Make Coverity more happy with r334545
Coverity complains about: if (((flags) & M_WAITOK) || _malloc_item != NULL) saying: The expression 1 /* (2 | 0x100) & 2 */ || _malloc_item != NULL is suspicious because it performs a Boolean operation on a constant other than 0 or 1. Although the code is correct, add "!= 0" to make it slightly more legible and to silence hundreds(?) of Coverity warnings. Reported by: Coverity Discussed with: mjg Sponsored by: Dell EMC
This commit is contained in:
parent
c41bbc0acb
commit
56009ba0ed
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334669
@ -191,9 +191,9 @@ void *malloc(size_t size, struct malloc_type *type, int flags) __malloc_like
|
||||
void *_malloc_item; \
|
||||
size_t _size = (size); \
|
||||
if (__builtin_constant_p(size) && __builtin_constant_p(flags) &&\
|
||||
((flags) & M_ZERO)) { \
|
||||
((flags) & M_ZERO) != 0) { \
|
||||
_malloc_item = malloc(_size, type, (flags) &~ M_ZERO); \
|
||||
if (((flags) & M_WAITOK) || _malloc_item != NULL) \
|
||||
if (((flags) & M_WAITOK) != 0 || _malloc_item != NULL) \
|
||||
bzero(_malloc_item, _size); \
|
||||
} else { \
|
||||
_malloc_item = malloc(_size, type, flags); \
|
||||
|
Loading…
Reference in New Issue
Block a user