From patchwork Fri Jul 14 09:31:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 107754 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp654630qge; Fri, 14 Jul 2017 02:33:31 -0700 (PDT) X-Received: by 10.101.87.200 with SMTP id q8mr13693989pgr.110.1500024811546; Fri, 14 Jul 2017 02:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500024811; cv=none; d=google.com; s=arc-20160816; b=lral/PAqG7n0xUOYLN/GPyx9P71iogEPApLsIAxQLMqP/a1x44TDzVTGA0xdy7wJlI o6mK9EQ/X2jI1Ajs4fluvqJIZUTSAnbZBZKyUgBaVsaOf1veqlT6ja+uBEf6cfeUs2Fx 88OARViaPAiwJRxvwRvqp6aNXk4cqtdYkF3+ekxjuDHpvtDL5NmzHXVRb0OZiUDSPKzo zkDSFIlUNtCV6NLoBl3yw3rTQTBOZgJNYsAZ3JZA/ogcGG3ZEJKm5kmlRNDJepwVc9Sg Oj01sphidxaXvohvbiw1hT8LTYpMt89kw5/NCU9Hr7TqyoJcn1KAQDmoStxCm6g00AW5 PIMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:delivered-to:arc-authentication-results; bh=n0W8nqNpWWKwtTStMvA95+DevOaE4jFepM9vUEooG8U=; b=HodgcR6d3ufRBSNh6Orp5zNQgjy2EmIXagM2P1xuct8mY1yZKhY+oT7Iy402yV0oaG 2P+7B2Hk/ey33Qwzpbgo1nPBIjx4DtjN4Y6dHe/TO8yVkDPJ87/v5HyrqV4LE+Ufw86j qNS0GV8qNLXrOhswHbGso0NmIehhhAnYme7umGD59BzNUt323oKeZ6IDoWaesrRC5w6g pSvgW9WFdQquQIPeqbSC+3htsqVfVgNOXD9+HIVd7O2oTIsNJxqyF1Ig2ZhH9FVGBHGN 2jUnba+e5+SgYqr+Yn0POejFq0z2W0xyLUEtng4+mKwqM0A2ifzcL2/IUcf/NgyEW21T WZFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id n65si6097960pfh.410.2017.07.14.02.33.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jul 2017 02:33:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D6226E7BC; Fri, 14 Jul 2017 09:32:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 405C06E105 for ; Fri, 14 Jul 2017 09:32:58 +0000 (UTC) Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0MD8M0-1dQUNY129E-00GZ5Z; Fri, 14 Jul 2017 11:32:00 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Doug Ledford , Sean Hefty , Hal Rosenstock Subject: [PATCH 11/14] IB/uverbs: fix gcc-7 type warning Date: Fri, 14 Jul 2017 11:31:04 +0200 Message-Id: <20170714093129.1366900-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170714092540.1217397-1-arnd@arndb.de> References: <20170714092540.1217397-1-arnd@arndb.de> X-Provags-ID: V03:K0:o0OfFsKc+1oG1N4Q1wsNXw7hMZxze8QccEOFVOhNnpUBV3/m8Po T9o1NkZUZCWDoboinZpY7y6c28R7nKbYgVZbycyICBvN/UQHz6GaMj9JGFaz8kUsTDcVX/W Yr7RKMnrBHVaEs5e69Gn7Oe2Fbi2m5K1wAIec3r3hB/khnTxPjqKEpfluafh9dkmc+ARUJh pD0jOMa/JLk28WUOXDuCg== X-UI-Out-Filterresults: notjunk:1; V01:K0:tor7iKgojos=:ALl7GsyUC3X2gDKIekAmii PkqSgAF1NaCfXLZcB53DmGq8ehwqd6rqzyEqv9sPiCqJ7oLEqWcNj5UoPziKGE75rfCWzudlf 7dSjDhfkDpV+WDXRxyKpJ41aFXSTEaSToWks6g94GBiiK/1y88jLyQ2lcqDKNcYDGe8zT0hX2 wSk5VhhDiqr90lqLqeHbAArUdmZSMilmib809MKySiINHgQll5sTuUVCp//Hs8M60OsYviPNo cFhX4AucGrFuvlvz2XLz8PbLg0KG5p1biCuLsC0OQV0OZJXwLVK6Af6gwWNX7/kJGfQIKA0eX 3YtuuwcXvyOO+vp6HxA3BMASewPu95cIgpARwjx/KCcmlsWxYoQWXq+C3h5Al0bOxjIIO1XxW 9Omo/DQfq7z46Aty5ct2GM3h+srCWcO73CaceSptBSi2SHer3oSeluRbcWXe4tRZ8sHylwNBp g9hfH1EV1v/yvsfLIqX6+CtQtqThB8Mlqst4iw7HvM50DCPO1pZRfvrI30tm8O+Y8Ism91ORy IEoyq7k5jk0/xOL7igsPaSZ0UY8PWSEDpCMx/IpJKLEUoP7pB1rGYyD56wKJlrEjVbVZFBRqg mFwcWBaanaatqB8NwrCcJwi6Tg1r0J5SIw88josakAUgUXA0lDDDbGwxijUQTzxIZyXx5z+OY j1yAZQxzUZvA7HxEeZUSboWLnMoe9nvLcwuYj+O6S57QaWMAie+CJwAnaqMk9YdAEE0uZMIJ3 UypIs5i+RkFrLIuPKsmOZf5OLQ0mc9CF/LRZbg== Cc: Leon Romanovsky , Arnd Bergmann , linux-rdma@vger.kernel.org, Greg Kroah-Hartman , Yishai Hadas , Matan Barak , dri-devel@lists.freedesktop.org, linux-ide@vger.kernel.org, Tejun Heo , akpm@linux-foundation.org, Linus Torvalds , Guenter Roeck , linux-media@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When using ccache, we get a harmless warning about the fact that we use the result of a multiplication as a condition: drivers/infiniband/core/uverbs_main.c: In function 'ib_uverbs_write': drivers/infiniband/core/uverbs_main.c:787:40: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] drivers/infiniband/core/uverbs_main.c:787:117: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] drivers/infiniband/core/uverbs_main.c:790:50: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] drivers/infiniband/core/uverbs_main.c:790:151: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] This changes the macro to explicitly check the number for a positive length, which avoids the warning. Fixes: a96e4e2ffe43 ("IB/uverbs: New macro to set pointers to NULL if length is 0 in INIT_UDATA()") Signed-off-by: Arnd Bergmann --- drivers/infiniband/core/uverbs.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h index 64d494a64daf..364d7de05721 100644 --- a/drivers/infiniband/core/uverbs.h +++ b/drivers/infiniband/core/uverbs.h @@ -55,12 +55,14 @@ (udata)->outlen = (olen); \ } while (0) -#define INIT_UDATA_BUF_OR_NULL(udata, ibuf, obuf, ilen, olen) \ - do { \ - (udata)->inbuf = (ilen) ? (const void __user *) (ibuf) : NULL; \ - (udata)->outbuf = (olen) ? (void __user *) (obuf) : NULL; \ - (udata)->inlen = (ilen); \ - (udata)->outlen = (olen); \ +#define INIT_UDATA_BUF_OR_NULL(udata, ibuf, obuf, ilen, olen) \ + do { \ + (udata)->inbuf = (ilen) > 0 ? \ + (const void __user *) (ibuf) : NULL; \ + (udata)->outbuf = (olen) > 0 ? \ + (void __user *) (obuf) : NULL; \ + (udata)->inlen = (ilen); \ + (udata)->outlen = (olen); \ } while (0) /*