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: 9840339 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 5D52360212 for ; Fri, 14 Jul 2017 09:33:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E85C2876E for ; Fri, 14 Jul 2017 09:33:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4352728787; Fri, 14 Jul 2017 09:33:18 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA48828777 for ; Fri, 14 Jul 2017 09:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753715AbdGNJdQ (ORCPT ); Fri, 14 Jul 2017 05:33:16 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:56742 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753552AbdGNJdO (ORCPT ); Fri, 14 Jul 2017 05:33:14 -0400 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 Cc: Greg Kroah-Hartman , Linus Torvalds , Tejun Heo , Guenter Roeck , linux-ide@vger.kernel.org, linux-media@vger.kernel.org, akpm@linux-foundation.org, dri-devel@lists.freedesktop.org, Arnd Bergmann , Matan Barak , Yishai Hadas , Leon Romanovsky , linux-rdma@vger.kernel.org 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== Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org 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 Reviewed-by: Leon Romanovsky --- 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) /*