Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1028632iob; Fri, 13 May 2022 20:13:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPwebyHFZgQweieGf4unBYJ4pag0mOwhFwZ8YMaYNUDPOpcKJoEht8pAJY567AnLwyU8Tb X-Received: by 2002:a05:600c:4e13:b0:394:797e:3358 with SMTP id b19-20020a05600c4e1300b00394797e3358mr17448886wmq.30.1652498021378; Fri, 13 May 2022 20:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652498021; cv=none; d=google.com; s=arc-20160816; b=xl6ttqdm01P4fdqRj7s9T1QlPlAMuPsLKb+g1Wx3vl9rxZiLUZoT9i9oKQ2A+XCQkb lwbKri8+vtB2IYXpWiB+ohVaefUjpiIQBvJivhRmzc9xt4mq8E2GlunZIZU83b9Co0Zu DiAfuy4gOcuqSVaZrERmvlkX5fZBBLqzYIiHpvVBNQDTTihpGZbAZJCl77bhAcxBrS+g qWp8+SkYDteMJ2vZR/Pd6rFK9Ig397RCbGMIJl2xFEOusUOGgj0tpmG7a0ceMu20Vb8K 1CXzI5vnMja62qEwjBcNYNqoQPfRiNoGcwtuWFIAKpCGKfqL0MeyM+EyBmWdA/RXVzoB rH4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IJFpavK52PKW+fz/d6rA5LnKM+BY4JKndV/MzLgbGxA=; b=QXmKFdsZA+egl0d2bu6Bv2SlyDZScVtCHnHJJ9UPkYu7soDNN0tv45v6/GmMzQhG8I Wvh1mJJv9d3dDwQ0ow1YCEAErvH2AcMz3xmV/cJjmTOcQ9fhHJwiIGGKnhaUDuYfAzAR URIsyCu2YiwshgkSVAxTgYpBoUUpdQ7uMwOHOWDAvtFiOWXMB7xeK7QFQEgOiNkJICn5 d6Kv8Hvldefxzaj3eWwgCdHOBiZxGmwvrJJbW7wDRyg1mFMdTw93zQ+6zsqg4fxS15cX JTS0lIKbtet5wD4n/x9xpaLJO0rvMKKXOK6vDpqJopR/oqxYM4QlmaxvdSBUlBCcoXZ+ hhvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xWdGiKZy; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q6-20020adfbb86000000b0020ad71c101csi3513931wrg.388.2022.05.13.20.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 20:13:41 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xWdGiKZy; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C83E23D6285; Fri, 13 May 2022 16:53:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380948AbiEMO3I (ORCPT + 99 others); Fri, 13 May 2022 10:29:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381025AbiEMO01 (ORCPT ); Fri, 13 May 2022 10:26:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C49661294; Fri, 13 May 2022 07:26:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED6FA62175; Fri, 13 May 2022 14:26:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 050AAC34115; Fri, 13 May 2022 14:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652451961; bh=5XYf6gXSLYCNV2NSOwWm/qXUoqIF9nuraWWShBEsE+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xWdGiKZyZj+vxISxQxKKqVe6HJSX8QvejTYfFtJgAsMDCIXqjJ0TZMibpx79z4QQb cJadO3UWmKsjSeYeATpSGLD4XRXbJvfoFQU2G2TAvT9gW7ajEf68JBYmKHOAw5+eyz J4IlmkW2Dme9g9Ps5M7gNar1csxUNN7qI9Pdqijw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Desaulniers , Nathan Chancellor , Jakub Kicinski Subject: [PATCH 4.19 04/15] nfp: bpf: silence bitwise vs. logical OR warning Date: Fri, 13 May 2022 16:23:26 +0200 Message-Id: <20220513142228.026954425@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220513142227.897535454@linuxfoundation.org> References: <20220513142227.897535454@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor commit 8a64ef042eab8a6cec04a6c79d44d1af79b628ca upstream. A new warning in clang points out two places in this driver where boolean expressions are being used with a bitwise OR instead of a logical one: drivers/net/ethernet/netronome/nfp/nfp_asm.c:199:20: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical] reg->src_lmextn = swreg_lmextn(lreg) | swreg_lmextn(rreg); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ || drivers/net/ethernet/netronome/nfp/nfp_asm.c:199:20: note: cast one or both operands to int to silence this warning drivers/net/ethernet/netronome/nfp/nfp_asm.c:280:20: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical] reg->src_lmextn = swreg_lmextn(lreg) | swreg_lmextn(rreg); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ || drivers/net/ethernet/netronome/nfp/nfp_asm.c:280:20: note: cast one or both operands to int to silence this warning 2 errors generated. The motivation for the warning is that logical operations short circuit while bitwise operations do not. In this case, it does not seem like short circuiting is harmful so implement the suggested fix of changing to a logical operation to fix the warning. Link: https://github.com/ClangBuiltLinux/linux/issues/1479 Reported-by: Nick Desaulniers Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers Link: https://lore.kernel.org/r/20211018193101.2340261-1-nathan@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/netronome/nfp/nfp_asm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/netronome/nfp/nfp_asm.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_asm.c @@ -226,7 +226,7 @@ int swreg_to_unrestricted(swreg dst, swr } reg->dst_lmextn = swreg_lmextn(dst); - reg->src_lmextn = swreg_lmextn(lreg) | swreg_lmextn(rreg); + reg->src_lmextn = swreg_lmextn(lreg) || swreg_lmextn(rreg); return 0; } @@ -307,7 +307,7 @@ int swreg_to_restricted(swreg dst, swreg } reg->dst_lmextn = swreg_lmextn(dst); - reg->src_lmextn = swreg_lmextn(lreg) | swreg_lmextn(rreg); + reg->src_lmextn = swreg_lmextn(lreg) || swreg_lmextn(rreg); return 0; }