Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81B0DCE835D for ; Mon, 30 Sep 2024 17:39:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0B83110E56D; Mon, 30 Sep 2024 17:39:32 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 2117110E56D for ; Mon, 30 Sep 2024 17:39:30 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 04E2C367 for ; Mon, 30 Sep 2024 10:40:00 -0700 (PDT) Received: from e110455-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4BF173F64C for ; Mon, 30 Sep 2024 10:39:30 -0700 (PDT) Date: Mon, 30 Sep 2024 18:39:26 +0100 From: Liviu Dudau To: Boris Brezillon Cc: Steven Price , =?utf-8?Q?Adri=C3=A1n?= Larumbe , dri-devel@lists.freedesktop.org, Julia Lawall , kernel@collabora.com, stable@vger.kernel.org, kernel test robot Subject: Re: [PATCH v2] drm/panthor: Fix access to uninitialized variable in tick_ctx_cleanup() Message-ID: References: <20240930163742.87036-1-boris.brezillon@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240930163742.87036-1-boris.brezillon@collabora.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, Sep 30, 2024 at 06:37:42PM +0200, Boris Brezillon wrote: > The group variable can't be used to retrieve ptdev in our second loop, > because it points to the previously iterated list_head, not a valid > group. Get the ptdev object from the scheduler instead. > > Cc: > Fixes: d72f049087d4 ("drm/panthor: Allow driver compilation") > Reported-by: kernel test robot > Reported-by: Julia Lawall > Closes: https://lore.kernel.org/r/202409302306.UDikqa03-lkp@intel.com/ > Signed-off-by: Boris Brezillon Reviewed-by: Liviu Dudau Best regards, Liviu > --- > drivers/gpu/drm/panthor/panthor_sched.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c > index 201d5e7a921e..24ff91c084e4 100644 > --- a/drivers/gpu/drm/panthor/panthor_sched.c > +++ b/drivers/gpu/drm/panthor/panthor_sched.c > @@ -2052,6 +2052,7 @@ static void > tick_ctx_cleanup(struct panthor_scheduler *sched, > struct panthor_sched_tick_ctx *ctx) > { > + struct panthor_device *ptdev = sched->ptdev; > struct panthor_group *group, *tmp; > u32 i; > > @@ -2060,7 +2061,7 @@ tick_ctx_cleanup(struct panthor_scheduler *sched, > /* If everything went fine, we should only have groups > * to be terminated in the old_groups lists. > */ > - drm_WARN_ON(&group->ptdev->base, !ctx->csg_upd_failed_mask && > + drm_WARN_ON(&ptdev->base, !ctx->csg_upd_failed_mask && > group_can_run(group)); > > if (!group_can_run(group)) { > @@ -2083,7 +2084,7 @@ tick_ctx_cleanup(struct panthor_scheduler *sched, > /* If everything went fine, the groups to schedule lists should > * be empty. > */ > - drm_WARN_ON(&group->ptdev->base, > + drm_WARN_ON(&ptdev->base, > !ctx->csg_upd_failed_mask && !list_empty(&ctx->groups[i])); > > list_for_each_entry_safe(group, tmp, &ctx->groups[i], run_node) { > -- > 2.46.0 > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯