From owner-svn-src-all@freebsd.org Tue Jun 5 15:38:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91CEDFF0478; Tue, 5 Jun 2018 15:38:36 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id BA4947F8AF; Tue, 5 Jun 2018 15:38:34 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 9F7D05646B; Tue, 5 Jun 2018 10:38:27 -0500 (CDT) Subject: Re: svn commit: r334545 - in head/sys: contrib/zstd/lib/freebsd kern netinet/libalias sys To: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201806022220.w52MK9TT026244@repo.freebsd.org> From: Eric van Gyzen Openpgp: preference=signencrypt Message-ID: <1b77e282-e24b-d14c-9811-4cf214d58280@vangyzen.net> Date: Tue, 5 Jun 2018 10:38:26 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <201806022220.w52MK9TT026244@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2018 15:38:36 -0000 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