svn commit: r334545 - in head/sys: contrib/zstd/lib/freebsd kern netinet/libalias sys
Eric van Gyzen
eric at vangyzen.net
Tue Jun 5 15:38:36 UTC 2018
On 06/02/2018 17:20, Mateusz Guzik wrote:
> +#ifdef _KERNEL
> +#define malloc(size, type, flags) ({ \
> + void *_malloc_item; \
> + size_t _size = (size); \
> + if (__builtin_constant_p(size) && __builtin_constant_p(flags) &&\
> + ((flags) & M_ZERO)) { \
> + _malloc_item = malloc(_size, type, (flags) &~ M_ZERO); \
> + if (((flags) & M_WAITOK) || _malloc_item != NULL) \
> + bzero(_malloc_item, _size); \
> + } else { \
> + _malloc_item = malloc(_size, type, flags); \
> + } \
> + _malloc_item; \
> +})
> +#endif
Mateusz,
Thank you for this and for all of your performance work. It is all very
interesting stuff.
Coverity complains about this line:
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.
Would you mind adding != 0 to appease Coverity?
Thanks,
Eric
More information about the svn-src-all
mailing list