Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp880756pxb; Tue, 3 Nov 2020 15:22:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8P91DCQbtYs0k+YPDhfEfZOZgX8cA60wahfgcR4BJrIuhAZK7Sr1AWl6PkGPTmG03Q6YP X-Received: by 2002:a17:906:5052:: with SMTP id e18mr21326725ejk.530.1604445752077; Tue, 03 Nov 2020 15:22:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604445752; cv=none; d=google.com; s=arc-20160816; b=Bf68oh3Q24lj2XhbImZU5BGMsdPEdm5Re4XTTQJ7i7nMd/G9VHDtsJLV6m8n9XGc4D 5yXK+9uk8KEPzQO/pImx5++vWophvOQUdTcIb9dm+x+8EYPIkzcfinePaZiJ4OqnB54Q YChn8r4164h5yXQ0kG2LjsEsIO5rx8QEtsshcaWg3aZzOuQHDOygdZWDjOeih42QW9Fg CsLk1stIwqzfHnsUkTbKx1z2MOWCsMIsTB3fRQDemv0rmkejkxhF5tU8Orxp5ljoq/O+ gajkdPpkqqIMJm5wKo75HJ6a14WVSo8VUaGRqLu2tJIdNA34yMGIUGq15sRm7j2wKjCj 0eHA== 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=eRbZntytsQBZ4GYmhdRenUZZ+q/3ZNUzwocVO2hX+Mg=; b=a7ReDSEXt0klxgyni0D89zP8eVUQDWQmyx/mKFN804qOCy84vpCWElFolIT2FUSh6a wMceVCbgPNlGN6UHVejRQ8ZPFqa7pkrhD7j4P27+w/tXukDN3x5byZxvqiypYNyXJDvz TJvLFq9IPYiJJM5RJQAb26Pu1rElyNo9w3uNeQyyLgao20FeLwCy425R+7Vp/2l9Xywv qXfXO+YWtvp8eMDBAvrMKextlVqSeEmMP5bw9Rgr05kj88s181WqdlCqVR/cNykHp/cp B3/3/KJQN8yG71jamcADjCCXVHo7hOpaV6ZVcweVZW2gYyryAYyWjCZvFWxUNcIAEag5 CBFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=floNHrDg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e10si239987ejl.139.2020.11.03.15.22.08; Tue, 03 Nov 2020 15:22:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=floNHrDg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387413AbgKCVBG (ORCPT + 99 others); Tue, 3 Nov 2020 16:01:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:37094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732410AbgKCVA5 (ORCPT ); Tue, 3 Nov 2020 16:00:57 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 89923223C7; Tue, 3 Nov 2020 21:00:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437257; bh=qAe2rnN958PsgWxtKniFbsM/EczxHG/amxzn10O82I8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=floNHrDg87EVZx3eySHDl/T1Fr5TxuNb6Mf+DXWSG8B8wNkbig7FT5eVCj3T1FBAC g7GFKs3puTqX3rwZDVDfugu5RuVm/CrzsvMRpnFVmHO75NVR891kmwkVUbTzAg3Xxl OQfuVfsnUZoSd5qs/eKfxBhfrCR9e0EqMECD2uvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Airlie , =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [PATCH 5.4 196/214] drm/ttm: fix eviction valuable range check. Date: Tue, 3 Nov 2020 21:37:24 +0100 Message-Id: <20201103203309.020978087@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Airlie commit fea456d82c19d201c21313864105876deabe148b upstream. This was adding size to start, but pfn and start are in pages, so it should be using num_pages. Not sure this fixes anything in the real world, just noticed it during refactoring. Signed-off-by: Dave Airlie Reviewed-by: Christian König Cc: stable@vger.kernel.org Link: https://patchwork.freedesktop.org/patch/msgid/20201019222257.1684769-2-airlied@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/ttm/ttm_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -761,7 +761,7 @@ bool ttm_bo_eviction_valuable(struct ttm /* Don't evict this BO if it's outside of the * requested placement range */ - if (place->fpfn >= (bo->mem.start + bo->mem.size) || + if (place->fpfn >= (bo->mem.start + bo->mem.num_pages) || (place->lpfn && place->lpfn <= bo->mem.start)) return false;