From patchwork Wed Sep 6 13:45:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 111778 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp898259qge; Wed, 6 Sep 2017 06:46:29 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5/LzT4EzR2oLrNyQg3foDt/eiQe/0kSZWHm2KVEDCog9gXUiwCKPfKk0XjKmD2CZnrJZGo X-Received: by 10.99.143.14 with SMTP id n14mr7797505pgd.339.1504705589598; Wed, 06 Sep 2017 06:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504705589; cv=none; d=google.com; s=arc-20160816; b=JGEpra+MLpP1mxPP8vnQi0GkQUUwIeAYJC4vyT6HO8G5i9V3e5iF7WbggWcn19o9Vr o9ZZYltQEQJIQozVrJb1J6bNL6dEqmqVibDxkLTsmnh52msNrNfscwSv3TXSLAAVVA6T CWxy89ilTH7HDOc2korZ3plRsBPr2Wvnr7VZeS03El79A5GcmWtR5F38VMEvI0SNa3Gh H374GrImM1dR2Z1p2enVxg/fMbL5aFVHdg3bqnxM9TkLBjU6h0oY4BClUFDY8Zfg7T1g v/r8kfBPBkiQ6IAQrlrz9Kdu1a+SOyQlw47wR2/PC0LnROWnoW3Wo8vRYUGd9ROB/zq8 +D6A== 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 :arc-authentication-results; bh=Gix6Y0fBBTfbeiJp4l9w+R6Vok47i7IrRENU3qAbM58=; b=dSbAdEI6XaW90CNtAYz9fSKMYEW9PEUdyl6Bji4FEtb2mr7mMWOhaVzzvl7I0fYJsO 219Z2si54LMYpvPUKQ986QIZg7GSlrQt6bMb3jSeI2CuSSx13ea4uPs6o4OxSDElrbn/ k5RKcJ3a9hK/T/2N3mh40yvuHf8z1CoCQQV+kgjjtgaFnjPoHQRQvM8+31jmawyeL5YL 9oZRVlxIUjG6weeGh8ZSLoRwu5BNKn2/F2IK6pfKf8xNWGFGGK6ciKtwvzWgfVHuh7kN bronb1WrnZ6BCJXRtmCp1sZlnPfkhRrGKB2IOFHA23Mg3a5zBZ/WXPx+U4Y3YPeO8+ds gazg== ARC-Authentication-Results: i=1; mx.google.com; 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 s9si1240279pgp.299.2017.09.06.06.46.29; Wed, 06 Sep 2017 06:46:29 -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; 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 S932267AbdIFNq0 (ORCPT + 26 others); Wed, 6 Sep 2017 09:46:26 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:64403 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932115AbdIFNqY (ORCPT ); Wed, 6 Sep 2017 09:46:24 -0400 Received: from wuerfel.lan ([95.208.190.237]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0MKyv2-1dpaeW3BvU-0007t4; Wed, 06 Sep 2017 15:46:00 +0200 From: Arnd Bergmann To: Doug Ledford , Sean Hefty , Hal Rosenstock Cc: Arnd Bergmann , Matan Barak , Yishai Hadas , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [RESEND] IB/uverbs: fix gcc-7 type warning Date: Wed, 6 Sep 2017 15:45:31 +0200 Message-Id: <20170906134558.3279199-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:3iiogugOjtfEJ2MZBpVqoDamXR+iyGuQgPuaX7AK6cUWFYN1esg orDNVXKV39gRLwD4dVcI9Cj8ZmE0bbJUE0aS3NWn3JZ4GtZnvnXL+NTdjS7F1+lCnSoI4Iv ia3uoLsN/OuVXsVypGN8YWYfuq1O85xeZb6Pw/71bdTONwL9BNXLOBMvGvNpU3fTxStPq8T yBRoF/c6OXgYPsBsEMGYA== X-UI-Out-Filterresults: notjunk:1; V01:K0:a+fXtguPk3A=:WF3liYWuuLC5OkAcbC6yCF lo1hP0Q0DCTfmpl9ia8YjU2+s4o8OTcMtFToplAX9wofNOLi7yXn5qS7i82fDdidaeuEzzL4D 6G+qVDzBZDCsOtOqsy7jOTj5SvturauyvcwWhY/lMjb8VnHhF2edRL30Cro8NACuEJ50a4zPE 35arhTab1sT2gJygohBplocPrfa+Wh2yqmC8YXMIsyBSjo61YPOyckxt3lAV+wSqYxPvqb3cg YeRk9wigX3woUH+Gkxl5fPLERrV11eks6sjL0WjEfpc1tt3Y55LSgaTZfdM1oLfk3nghOgjsf svbMD6AUtPT3ssP1YZmtaoneEvzIQu5wpWtMRyp/L0W9zJ6ohzsK68QXJYjEp/lYGTavEBU7D enDGUEjGZOxubxUj1Rv+ZvXbA+t2dW/I8fnhwvlJw8c3sTvNqFKGpx3mozY7SSSOLAMcbCjwn Px5ffaBwNoagk+0x935wgJFsa0RF2EhrRwMkqP6mUEZ7HYaPftp8wdwPFZEWTuRQG3TieNJar Rw2H0cBaK0AHtWwjC9ModJc6S9/obdl7QYFJtUA03pt9aF+hjBBP5PDVyqsa0a08QZtGns44c sk2r2ITFk9G8DsbQrvVHZW7OpEhlB+z3w2b92ryLp98XLBy1pJCDpV+P18J2YuuCbiSK9EZJg G4UB5YWFF4GnYrIKR78LrynEHEUF/UFO80zzAU7UiKdtO8lolYWAnnGwTEq994AbGU1p+CFq0 riC7GlD3AU0YPKSqvV9pL51D/QGBZsNGjQkmCQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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()") Reviewed-by: Leon Romanovsky Signed-off-by: Arnd Bergmann --- Originally submitted on July 14, but this patch is still pending. I modified the change text this time, as the first version incorrectly stated that it only happens with ccache. --- drivers/infiniband/core/uverbs.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) -- 2.9.0 diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h index 37c8903e7fd0..986a8a66ebbe 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) /*