Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Jun 2018 18:35:37 +0200
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Eric van Gyzen <eric@vangyzen.net>
Cc:        Mateusz Guzik <mjg@freebsd.org>, src-committers <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:  <CAGudoHGcZ9b8fvQVx-+xqsr47GzrTZR6+h2C_EqTp3rSjGvATw@mail.gmail.com>
In-Reply-To: <1b77e282-e24b-d14c-9811-4cf214d58280@vangyzen.net>
References:  <201806022220.w52MK9TT026244@repo.freebsd.org> <1b77e282-e24b-d14c-9811-4cf214d58280@vangyzen.net>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Tue, Jun 5, 2018 at 5:38 PM, Eric van Gyzen <eric@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>



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?CAGudoHGcZ9b8fvQVx-+xqsr47GzrTZR6+h2C_EqTp3rSjGvATw>