From owner-svn-src-head@freebsd.org Tue Jun 5 20:34:12 2018 Return-Path: Delivered-To: svn-src-head@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 6C343FF57DA; Tue, 5 Jun 2018 20:34:12 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0904A70B8E; Tue, 5 Jun 2018 20:34:12 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8CF321515; Tue, 5 Jun 2018 20:34:11 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w55KYBiU096419; Tue, 5 Jun 2018 20:34:11 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w55KYBsb096418; Tue, 5 Jun 2018 20:34:11 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201806052034.w55KYBsb096418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Tue, 5 Jun 2018 20:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334669 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 334669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2018 20:34:12 -0000 Author: vangyzen Date: Tue Jun 5 20:34:11 2018 New Revision: 334669 URL: https://svnweb.freebsd.org/changeset/base/334669 Log: Make Coverity more happy with r334545 Coverity complains about: 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. Although the code is correct, add "!= 0" to make it slightly more legible and to silence hundreds(?) of Coverity warnings. Reported by: Coverity Discussed with: mjg Sponsored by: Dell EMC Modified: head/sys/sys/malloc.h Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Tue Jun 5 20:13:24 2018 (r334668) +++ head/sys/sys/malloc.h Tue Jun 5 20:34:11 2018 (r334669) @@ -191,9 +191,9 @@ void *malloc(size_t size, struct malloc_type *type, in void *_malloc_item; \ size_t _size = (size); \ if (__builtin_constant_p(size) && __builtin_constant_p(flags) &&\ - ((flags) & M_ZERO)) { \ + ((flags) & M_ZERO) != 0) { \ _malloc_item = malloc(_size, type, (flags) &~ M_ZERO); \ - if (((flags) & M_WAITOK) || _malloc_item != NULL) \ + if (((flags) & M_WAITOK) != 0 || _malloc_item != NULL) \ bzero(_malloc_item, _size); \ } else { \ _malloc_item = malloc(_size, type, flags); \