Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753835AbdGNJdQ (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 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1961 Lines: 45 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) /* -- 2.9.0