mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
To: Boris Brezillon <boris.brezillon@collabora.com>,
	Steven Price <steven.price@arm.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Heiko Stuebner <heiko@sntech.de>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: dan.carpenter@linaro.org, kernel-janitors@vger.kernel.org,
	error27@gmail.com
Subject: Re: [PATCH] drm/panthor: Fix IS_ERR() vs NULL bug in group_process_tiler_oom()
Date: Tue, 2 Apr 2024 16:53:53 +0530	[thread overview]
Message-ID: <6a6ebf5a-da64-4c5b-b819-cbcbb097fb55@oracle.com> (raw)
In-Reply-To: <20240402111740.1700310-1-harshit.m.mogalapalli@oracle.com>

Hi,

On 02/04/24 16:47, Harshit Mogalapalli wrote:
> panthor_vm_get_heap_pool() returns ERR_PTR on failure, update the check
> accordingly.
> 
> Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> This is based on static analysis with smatch, only compile tested.
> ---
>   drivers/gpu/drm/panthor/panthor_sched.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index 5f7803b6fc48..d34f213795a3 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -1343,7 +1343,10 @@ static int group_process_tiler_oom(struct panthor_group *group, u32 cs_id)
>   	if (unlikely(csg_id < 0))
>   		return 0;
>   
> -	if (!heaps || frag_end > vt_end || vt_end >= vt_start) {
> +	if (IS_ERR(heaps))
> +		return PTR_ERR(heaps);
> +

Please ignore this patch, doesn't look correct on looking at more closely.

I should have just done this:

diff --git a/drivers/gpu/drm/panthor/panthor_sched.c 
b/drivers/gpu/drm/panthor/panthor_sched.c
index 5f7803b6fc48..617df2b980d0 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c
@@ -1343,7 +1343,7 @@ static int group_process_tiler_oom(struct 
panthor_group *group, u32 cs_id)
         if (unlikely(csg_id < 0))
                 return 0;

-       if (!heaps || frag_end > vt_end || vt_end >= vt_start) {
+       if (IS_ERR(heaps) || frag_end > vt_end || vt_end >= vt_start) {
                 ret = -EINVAL;
         } else {
                 /* We do the allocation without holding the scheduler 
lock to avoid


Thanks,
Harshit


> +	if (frag_end > vt_end || vt_end >= vt_start) {
>   		ret = -EINVAL;
>   	} else {
>   		/* We do the allocation without holding the scheduler lock to avoid


      reply	other threads:[~2024-04-02 11:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 11:17 Harshit Mogalapalli
2024-04-02 11:23 ` Harshit Mogalapalli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a6ebf5a-da64-4c5b-b819-cbcbb097fb55@oracle.com \
    --to=harshit.m.mogalapalli@oracle.com \
    --cc=airlied@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=dan.carpenter@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=error27@gmail.com \
    --cc=heiko@sntech.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=steven.price@arm.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®