From patchwork Thu Jun 22 10:15:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 111608 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4966330vqr; Thu, 22 Jun 2023 03:36:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5fXLjpAYCO0Me4+KOsdJTkZJiqfdo9E8/RSMwMQoVU1NpxObKWUee7H0JGAq+orEhKew5y X-Received: by 2002:a05:6808:2810:b0:398:4761:20d with SMTP id et16-20020a056808281000b003984761020dmr18043691oib.19.1687430194564; Thu, 22 Jun 2023 03:36:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687430194; cv=none; d=google.com; s=arc-20160816; b=hhslY4hkyWd8MVwZdkudWzgaxXwGrhZHbic9MODftqCvDE9Wxi5PJoObgFiGM+jVhL iadkkZBfaqtx5OfW8pA5coV/XQcUNBhivEBYf8OsogaRl3T3DjovgvF5vpe28jjKcqrh Hfr265O63Qhl85v+jKNAfAoFWgTSv2hUDzGazJbb6daJyhAj1HHgYmiZ0i+DEKIb0Uif AwOFbjq4ux51pefdr3ic+Kw/XUyKPH/iIvLCtWdqOm/Gv5OjP8d8+UUsKWYY/PLab5lm 3+kNOqLcEydWGbYK/vaPTwu3EWR/U+4mMsw6JgtFDKX4fBtATfzlp4uOT3n9YyqN0aL0 ADFw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=1z6O6BfFnnLx77Pzmi+lY9/uXbeutcwdIx3ThhgsR3o=; b=bpkFt6xeDWpVlt40bOxNeWVKImdtzlzoYV+uPL5HgcqO/PEyn/loklCea1QSkprJ2E vzjgs+WGV8Xg2p+U1Oh7/pXBfMacXHSydpgp6HoI3ANJHsnkAzNZOrVNFwZcgY2Wfswo +1ZhxHUEZsINPmbtgYJ+qC9HVyL8OoB67DClUyn7vMghadNOgyAXwiEdZCgpaFRdVpUY 27DYlleJIEvxhyrT+ymUX43U3fztVrSSVsgVJTt6c9man7kYlI1R0jyXccH5sNrK1Zvw rZCwYP1Kjjq/MlzrNpcez6Jn0fsxqZ1e/vFVW4yfcVQrjFSHihAs/VOuvFdbPXoBoFXh OY6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AfDR9xsG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ob18-20020a17090b391200b0025698fca606si6881175pjb.109.2023.06.22.03.36.18; Thu, 22 Jun 2023 03:36:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AfDR9xsG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230494AbjFVKPu (ORCPT + 99 others); Thu, 22 Jun 2023 06:15:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231446AbjFVKPj (ORCPT ); Thu, 22 Jun 2023 06:15:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B9421B4; Thu, 22 Jun 2023 03:15:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D2BA7616CB; Thu, 22 Jun 2023 10:15:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4208C433C0; Thu, 22 Jun 2023 10:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687428932; bh=ddwNq7oMVHZRi+PxOrJpIvndAOCIW9Xj14GqlgpwMA0=; h=From:To:Cc:Subject:Date:From; b=AfDR9xsGjodZLtdc65RB5nqBaVJu06rRUp21I7Hw3wetmfaWPNi5vdgNf3cKJBu8H wMZFvpAjv3u2x+bNi7eJ8BvWZWlyz/JE98CtHOH6xXFwIKcDSHvB7mezD7Gf7nIDud UX3pVYcs3yx6tjdW/kJIxuu7k5MF2OPL6AKGmdG/0pEoOYr5B1npe5I2VelDSACJdK MvgcTNwzAnG0s8LZVrTalK5QshnpzfVoPY/dXX8dZEi8olKSURfIUwzlzm1Aw4sMMf oIPXM+hczyzpELBKEMapdd7lRZO4iUzlWI2X31WaWhvwIEGX1Y3cnc9svGRVYLlGtc VTVqaOnaQ6XdA== From: Arnd Bergmann To: Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Tom Rix , Tariq Toukan , Maxim Mikityanskiy , Adham Faris , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] mlx5: avoid integer overflow warning for large page size Date: Thu, 22 Jun 2023 12:15:02 +0200 Message-Id: <20230622101525.3321642-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769398803294479033?= X-GMAIL-MSGID: =?utf-8?q?1769398803294479033?= From: Arnd Bergmann Build testing with 'make LLVM=1 W=1' shows a warning about a condition that is always true on configurations with 64KB pages: drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c:32:22: error: result of comparison of constant 65536 with expression of type 'u16' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare] Change the condition in a way that lets clang know this is intentional. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c index 36826b5824847..b9f62e531bd4c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c @@ -29,7 +29,8 @@ bool mlx5e_validate_xsk_param(struct mlx5e_params *params, struct mlx5_core_dev *mdev) { /* AF_XDP doesn't support frames larger than PAGE_SIZE. */ - if (xsk->chunk_size > PAGE_SIZE || xsk->chunk_size < MLX5E_MIN_XSK_CHUNK_SIZE) { + if ((PAGE_SIZE < U16_MAX && xsk->chunk_size > PAGE_SIZE) + || xsk->chunk_size < MLX5E_MIN_XSK_CHUNK_SIZE) { mlx5_core_err(mdev, "XSK chunk size %u out of bounds [%u, %lu]\n", xsk->chunk_size, MLX5E_MIN_XSK_CHUNK_SIZE, PAGE_SIZE); return false;