Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10677283rwd; Thu, 22 Jun 2023 03:21:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KN56rMRkQQHQDiqaA9MSm5vS7HdR/jn0Z6PAhKEt/DMDfaorkanm/+0UqB+0sD168eou0 X-Received: by 2002:a05:6a20:4294:b0:114:c11c:7ad5 with SMTP id o20-20020a056a20429400b00114c11c7ad5mr19211866pzj.52.1687429284742; Thu, 22 Jun 2023 03:21:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687429284; cv=none; d=google.com; s=arc-20160816; b=wkLHoQ0JnaDVSozTWlKtwvhPv11UeZmYgKS2UBjikaydQfYJ5VJY6IdCjNBbdCfwBE la22JqTnISvDV4039IQ2KEvdQYPVcoXW7KiNcmZ+xPEDx0MVofAR/mTltGueCJHCxjk9 4tJMfyTs22UDwMAO2W1+13G6eZP+NxMVqmphgIEIRYbbW/44+EosxuJQ7nbeCCNlOmo+ TvR+86eEZ0Zu5CbNKwqpstFxtPHHZVzUt8pnyYMVq+hSmVyilEYLyZmgbIjS3J7z01rh U+XY1clLo3hyxOuBRYcGUpKgrWAGJfblvdTdpdBwTBTzqGkavcmXvMVHTr1+ISam1k1E 9uow== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay39-20020a056a00302700b0066a48d3ea84si1598999pfb.306.2023.06.22.03.21.12; Thu, 22 Jun 2023 03:21:24 -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 S230452AbjFVKPu (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 Content-Transfer-Encoding: 8bit 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 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; -- 2.39.2