Date: Tue, 5 Jun 2018 10:38:26 -0500 From: Eric van Gyzen <eric@vangyzen.net> To: Mateusz Guzik <mjg@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334545 - in head/sys: contrib/zstd/lib/freebsd kern netinet/libalias sys Message-ID: <1b77e282-e24b-d14c-9811-4cf214d58280@vangyzen.net> In-Reply-To: <201806022220.w52MK9TT026244@repo.freebsd.org> References: <201806022220.w52MK9TT026244@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1b77e282-e24b-d14c-9811-4cf214d58280>
