On Tue, Jun 5, 2018 at 5:38 PM, Eric van Gyzen <e...@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>
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to