svn commit: r334545 - in head/sys: contrib/zstd/lib/freebsd kern netinet/libalias sys
Mateusz Guzik
mjguzik at gmail.com
Tue Jun 5 16:35:39 UTC 2018
On Tue, Jun 5, 2018 at 5:38 PM, Eric van Gyzen <eric at vangyzen.net> wrote:
> 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.
>
>
Thank you for the kind words. It is positive feedback like this which
keeps me going!
> 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?
>
Please go ahead.
--
Mateusz Guzik <mjguzik gmail.com>
More information about the svn-src-head
mailing list