From patchwork Tue Nov 3 20:37:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 316994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C34A8C388F7 for ; Tue, 3 Nov 2020 21:19:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D8A0206B5 for ; Tue, 3 Nov 2020 21:19:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604438391; bh=d6BMHzK4XpMulQAyPTS2drc2oo+njpraHmLdyy4Jkz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LXt3ofsthMH26XgKdWhgcyFUryAhOiMaLKEJI/AppaCvvCylJeIsqoDZx7/BMorUs z/xOKSMNQI8ySRsZ5Ei6OoTn8llLnf+4U8dtILaVwR+B/LUVy/qVbER40KrgoeT4nY rIfT5VkWgBtCOrq2GYJVC8hg5hKbS0vGife1lQao= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729752AbgKCVTu (ORCPT ); Tue, 3 Nov 2020 16:19:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:47218 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388355AbgKCVHw (ORCPT ); Tue, 3 Nov 2020 16:07:52 -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 AEF82205ED; Tue, 3 Nov 2020 21:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437672; bh=d6BMHzK4XpMulQAyPTS2drc2oo+njpraHmLdyy4Jkz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RLYRfiVYJqubH/4QveLCa0E2JC0AVHg549IitzB/b0TZ7flQi1sXCjRakY7V5n3FQ aCBeYXxAZ4HFZl2PRlpVfs0oCyWxF1BrtuLsYuWIKyt3Ly96JNnwn5jSI1uQgK/CYN LIualF+zJGrtG/IW2MzjsRFML4NpNb1vOTiAwgBc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Airlie , =?utf-8?q?Christian_K=C3=B6nig?= Subject: [PATCH 4.19 177/191] drm/ttm: fix eviction valuable range check. Date: Tue, 3 Nov 2020 21:37:49 +0100 Message-Id: <20201103203249.196811678@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -671,7 +671,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;