Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3527698pxf; Mon, 15 Mar 2021 11:33:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/3U7C1M6jR0qXAYcbEm/kNhkOE0Vq8YxLYxephJ4zO8VVdqrpxSHfuQ3JJ09Pe0YAGGrd X-Received: by 2002:a17:906:4f02:: with SMTP id t2mr25100946eju.121.1615833180119; Mon, 15 Mar 2021 11:33:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833180; cv=none; d=google.com; s=arc-20160816; b=Tgc+IqaYoovsihacV6owM8tXP2qfNfAESKBzqmJMjCcZTcS9KJnhVFf0Rp8Ph+NAWO RGpanOfk2Y9i7RPWC8olVnXTl9hgXWLRCvx1RUSzaLsSmTiVWJoXGXOaRiTl1zEV5USW 4B4RT6vYSAt01Xb6STN3Znmtq1DcJf8qOTNCy9CKROE7AAjRYtalEI5d4zLXO+2Se5rN T0pJ89LAtuTI6SsuJmRbl+z0bErrilcQbTxo7rr8rtrtr3TGtPvz2WrtmfkWj3FlYeDF ZcxsF2dFnJcVJirpIPlAbSzmm64+eSxSJHK8s848XZMhJeuX+kVZ6ytoIKTzd8MMrl0+ TkcQ== 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=kj4eg/I2Lm8e5RBaMYL39uzuBI8TlWtCD/v0rtwce6I=; b=ac/uxcK3efHeY0abTcxoxkUBzJBvL1PzT+yBMQW6LvvEwB9LemDImYyqperGsJVoFJ SXF0QuYaMN5Ul02THttWSwPG6b6J2KYNSp9bljfSYqSArJzDQWRNK1Lmz6OGgS55+xYM T0Fn6iMjWv+n7SSOJEhqwjM6NSzkMvkSVuA6h9mWefj/r6t5ySFuGNgkuqU8h/bQU/ae zgHjNTWkjpgw3p553dVeMe11hfBUVdsruPnkF7nIXB7Ema9PTx0Cw7y9soNECJENByxr VfaYNfMyzGjiVVx9aqa9sZSyGHUYttvGvTQgnwrETOOlUzsSpFtG4uea392RNDfAT+nx avoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uxasuCUQ; 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=pass (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 c13si11754162eje.45.2021.03.15.11.32.37; Mon, 15 Mar 2021 11:33:00 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=uxasuCUQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237308AbhCOOnH (ORCPT + 99 others); Mon, 15 Mar 2021 10:43:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:49734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234471AbhCOODY (ORCPT ); Mon, 15 Mar 2021 10:03:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4406564E83; Mon, 15 Mar 2021 14:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615817004; bh=65FGN8tFjwc5m23owKilo2IaNt4swdnOZ2xh3T4ygqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uxasuCUQ/ndmpM95igljsMRP3LY1snhXNkKh0se/D+FJgnBqaeFIvmFF3M2MvIVcf 3E7M0EQyvG6FBf05AJHE3ko7BhrEUHICMIgImrldpxYSlTVYA+zFKv6yWzNg6bgJLg souTohcVgnvgO7lNbyL8LqX/3GBfi9kQqtcgHya4= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Airlie , "Michael J. Ruhl" , Sasha Levin Subject: [PATCH 5.11 255/306] drm/nouveau: fix dma syncing for loops (v2) Date: Mon, 15 Mar 2021 14:55:18 +0100 Message-Id: <20210315135516.263822597@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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: Greg Kroah-Hartman From: Dave Airlie [ Upstream commit 4042160c2e5433e0759782c402292a90b5bf458d ] The index variable should only be increased in one place. Noticed this while trying to track down another oops. v2: use while loop. Fixes: f295c8cfec83 ("drm/nouveau: fix dma syncing warning with debugging on.") Signed-off-by: Dave Airlie Reviewed-by: Michael J. Ruhl Signed-off-by: Dave Airlie Link: https://patchwork.freedesktop.org/patch/msgid/20210311043527.5376-1-airlied@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/nouveau/nouveau_bo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 7ea367a5444d..f1c9a22083be 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -556,7 +556,8 @@ nouveau_bo_sync_for_device(struct nouveau_bo *nvbo) if (nvbo->force_coherent) return; - for (i = 0; i < ttm_dma->num_pages; ++i) { + i = 0; + while (i < ttm_dma->num_pages) { struct page *p = ttm_dma->pages[i]; size_t num_pages = 1; @@ -587,7 +588,8 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo *nvbo) if (nvbo->force_coherent) return; - for (i = 0; i < ttm_dma->num_pages; ++i) { + i = 0; + while (i < ttm_dma->num_pages) { struct page *p = ttm_dma->pages[i]; size_t num_pages = 1; -- 2.30.1