Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp815520imm; Thu, 5 Jul 2018 09:19:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeVBjpwNPbeyYZ9BmzeOVZCGLdIwa++Ik4hrUdFMx9R4ucSfPe77z+rFxvCrU/SM9qcYH68 X-Received: by 2002:a65:5ac9:: with SMTP id d9-v6mr6247609pgt.238.1530807573316; Thu, 05 Jul 2018 09:19:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530807573; cv=none; d=google.com; s=arc-20160816; b=jUPrHjO3LQ1Hhg09wLiB9J6LsGtjynEptThgwaZRcnf9GeIY/3XLCcF/dCFnVtXETH uhjVHbOk3a/egaYqaEwCymM7Ywea3kBhDdKZZj1V0PRm7WfIk4fCTvAqVbF8cqjsRNMW 9qt/2DSvwIypkPYYcyOOM8+MAn++IK8mZlzH+mYv+2G2Y3lQM/8M7u3uan8cErcp38a5 T2qf9noTD67gegs0uOLpA7QiQ4irXLfIhwye1EThPa1rksHgir7CrTTSg2mVt0QRr7lH q7flbcIUvxDzHLOu8i9c8/v9hpZ6npG5mf2Y64ISRoqOFp0H3EpFCEHN17J73tyCSizu ZfhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=NNi3cayBz72R2XUNtTZMHEba7kPb9s4APE84PNacI9Q=; b=lyaPGdah2a/CH1ckOiEtvZS5tBeC7q9dqByIYUMZCVYJ+K+zowfIGc4giGpmwwqMGu LB9whaGEVJKn4NcJUoONorxkZD6rKLnAagoVdbZBiIN6T+TYohKuUlrd405v6ZH1UBOZ bTHJS/qsno8YOFRTf0BHx1hGvk7r+QMMT9k2ul6gG+Yfsrd0Y9Xc9gwdEwmCEE3h1YuP hjHKG211UEb2US2c1C9covaIk6X9F/h1KDpHVWxJScKbVm6qnvTi5I2dj6vOeKX2xnR/ jbiQVLACpJ27/pYEwHLUMTalYw9ldbduBLpontT5TAnCi5U77uzywLd4GErMbK8gBGNQ expw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=oiqCC0p6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bi1-v6si6114386plb.126.2018.07.05.09.19.19; Thu, 05 Jul 2018 09:19:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=oiqCC0p6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753874AbeGEQRM (ORCPT + 99 others); Thu, 5 Jul 2018 12:17:12 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:7113 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753806AbeGEQRK (ORCPT ); Thu, 5 Jul 2018 12:17:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1530807541; x=1562343541; h=from:to:cc:subject:date:message-id; bh=qsGoYPO0xk7piBX0sLdQJHrqQ/Wcwd6Uh5XGclONRwo=; b=oiqCC0p6LkFNdj2T3mMUTi2VlpIuPbgD1/6oMpXJWsQ3YrCwX19D/cPa cF9aDFYkESEhX9Nac1fs0cxWZLhDhg8dPD5PAvNbyJDwnWWXKCbT5zH2a nB6Qu2B4gZuJ7Wp3vkQolLrzwjfd/bMt0w24X1ST/ISAE2p05sBdmMc7M XtenFuq1dC0lvQwp5i6SGh4xr81dBz+7W54wroyidKfvA/271nEGMZ3Mg efdM7S7OAVAPZC5sZeakgvyt299GLGrNyHhlCdgayMGFwXkrGp3BLb4f+ 7Fwns8D0aI5bJfYRhSFWsZn4bnAE0D8jpwCwGCxnKTCgWxzct9BkPGm2m Q==; X-IronPort-AV: E=Sophos;i="5.51,313,1526313600"; d="scan'208";a="180318687" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 06 Jul 2018 00:19:00 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 05 Jul 2018 09:06:11 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip02.wdc.com with ESMTP; 05 Jul 2018 09:17:11 -0700 From: Bart Van Assche To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Bart Van Assche , Martin Uecker , Kees Cook , Ingo Molnar , Miguel Ojeda , stable@vger.kernel.org Subject: [PATCH] kernel.h: Avoid that sparse complains about using sizeof(void) Date: Thu, 5 Jul 2018 09:17:09 -0700 Message-Id: <20180705161709.17028-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The macro __is_constexpr() causes sparse to report the following: warning: expression using sizeof(void) Avoid this by using __builtin_constant_p() instead. Fixes: 3c8ba0d61d04 ("kernel.h: Retain constant expression output for max()/min()") Signed-off-by: Bart Van Assche Cc: Linus Torvalds Cc: Martin Uecker Cc: Kees Cook Cc: Ingo Molnar Cc: Miguel Ojeda Cc: --- include/linux/kernel.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d23123238534..a9f0d0d48971 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -811,13 +811,19 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } #define __typecheck(x, y) \ (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) +#ifndef __CHECKER__ /* * This returns a constant expression while determining if an argument is * a constant expression, most importantly without evaluating the argument. - * Glory to Martin Uecker + * Glory to Martin Uecker . However, this + * macro causes sparse to report the warning "expression using sizeof(void)". + * Hence use __builtin_constant_p() instead when using sparse. */ #define __is_constexpr(x) \ (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) +#else +#define __is_constexpr(x) __builtin_constant_p((x)) +#endif #define __no_side_effects(x, y) \ (__is_constexpr(x) && __is_constexpr(y)) -- 2.18.0