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
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to