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: 9840333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2379D60212 for ; Fri, 14 Jul 2017 09:33:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14D692876A for ; Fri, 14 Jul 2017 09:33:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09B6928780; Fri, 14 Jul 2017 09:33:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D8182876A for ; Fri, 14 Jul 2017 09:33:01 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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) /*