From patchwork Mon Jul 3 12:35:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 115340 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp496030vqx; Mon, 3 Jul 2023 05:48:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6agv6cT5pLAmCZI3aTLZCESVTm+4oa2s7HRWdk74JBVeUV4VL7HoFYddrMktmVGATLa9X5 X-Received: by 2002:aca:e107:0:b0:39c:ecd4:8749 with SMTP id y7-20020acae107000000b0039cecd48749mr6094364oig.5.1688388533787; Mon, 03 Jul 2023 05:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688388533; cv=none; d=google.com; s=arc-20160816; b=qHopY19kjFXAEOjumvS2vUWfoM2YrW423RQ7c1IVVxi6DHX6Yq2vFL8yUn8kysn7ze vN1wkF2TMt45LxSIRglWlwImV/kgH1fs9piK3qLU//vYDDD5Ui2tf6FeO7WjEf5jFB10 rFrEhWyB0PKI56M9kEmgaTWLe0+b37B6+QANjTBA2HbN9ZEQYcu+YVwi5yV5T/qWCW24 8gedLwDFz0WEcvGupjZ34hqc/YwD+mRlYpZ5i8PQGm128zFgR+2r4RXDOMfnb9QtqBJS RejzfKFsVecedsKWhTgkjzC61tKl48gqgeG1SjHWpRlaI/3iLIdbpXFkjsnmTH72T2Vj +jPg== 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=gOgL0M50Rn0HpNfBR62ZTWphKQzIYBz9ZnWiJqQlucA=; fh=UrRYxSJQicISpMys9cciu8ikPh2P21sapDb91IitbL4=; b=f4b7Y9PY2OKt15GOf70Fxxsr5Xg9XqqufzKIRlRBUymMSkvm5wtUg4TkpbJ+VtBjkP VRZG9IAEhnMWIwu+/bdrymB+fhfVyDprY7L2rzoywFGrtPUdsAmMhy1Iyy9vZVScquAV J6XajqGPXeRw6usEnfpkbxj91HthlnP0wVfXW3U3cNfYMmZBgv5cnYo8e+qAwb7y9G7w L2lF2mnGCjZCEiA+NVpyYje7/CPAFXoVKsUxo1brdwC4hR1z5MNbRKjJP6/X6bLBXKGU QzrMSezMziNro/WP9KIO/fHE3M3m1Z5qVy8CNkvYbyE4YxacLVqM9vRXtR3UWz8ZzRUc 0WuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DZLcDDKv; 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 k184-20020a6324c1000000b00541710a9d44si18050645pgk.114.2023.07.03.05.48.38; Mon, 03 Jul 2023 05:48:53 -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=DZLcDDKv; 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 S230072AbjGCMgI (ORCPT + 99 others); Mon, 3 Jul 2023 08:36:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229656AbjGCMgG (ORCPT ); Mon, 3 Jul 2023 08:36:06 -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 0276D115 for ; Mon, 3 Jul 2023 05:36:06 -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 8A08A60F14 for ; Mon, 3 Jul 2023 12:36:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51115C433D9; Mon, 3 Jul 2023 12:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688387765; bh=8pRVnz7l/AWZY8R6a2pMc6+C9qMNZAMoJ59TR8NJIO0=; h=From:To:Cc:Subject:Date:From; b=DZLcDDKvSxSTlWD4URjmpKjyoA7HRwAyBFPaqyTHxpjhmm3nUChEjL5c73BbXSp33 QWU+n/0gPMEpL9fceFAujDyjMffuS1hzoQJsVI6j6ImASFy8SO0oSGq69uotxEhMCw ag4fpWtODUz+PLLJX+iZRIdjp0lph64ubJnFcNprRVbBcpQVLXrecePaqIlJmUPnfw kphGwx6UiNShSXEIjGtmuqJE45gnBCUlonNvSferCdcIOvHM3jSvheiwJ5nO8/WP9L OPC5FB3WoWvY9d4MpwPSA9qKv9YqPYDl5D7+yuF+9GeX9Alj0lZw2kAr/lF6dyPc2S S0J5j13mbhkmQ== From: Arnd Bergmann To: Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter Cc: Arnd Bergmann , Hawking Zhang , Lijo Lazar , Mario Limonciello , YiPeng Chai , Le Ma , Bokun Zhang , Srinivasan Shanmugam , Shiwu Zhang , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/amdgpu: avoid integer overflow warning in amdgpu_device_resize_fb_bar() Date: Mon, 3 Jul 2023 14:35:49 +0200 Message-Id: <20230703123557.3355657-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?1770403694855348428?= X-GMAIL-MSGID: =?utf-8?q?1770403694855348428?= From: Arnd Bergmann On 32-bit architectures comparing a resource against a value larger than U32_MAX can cause a warning: drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1344:18: error: result of comparison of constant 4294967296 with expression of type 'resource_size_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare] res->start > 0x100000000ull) ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ The compiler is right that this cannot happen in this configuration, which is ok, so just add a cast to shut up the warning. Fixes: 31b8adab3247e ("drm/amdgpu: require a root bus window above 4GB for BAR resize") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 7f069e1731fee..abd13942aac5d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1341,7 +1341,7 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev) pci_bus_for_each_resource(root, res, i) { if (res && res->flags & (IORESOURCE_MEM | IORESOURCE_MEM_64) && - res->start > 0x100000000ull) + (u64)res->start > 0x100000000ull) break; }