* [PATCH] drm/panthor: Fix IS_ERR() vs NULL bug in group_process_tiler_oom()
@ 2024-04-02 11:17 Harshit Mogalapalli
2024-04-02 11:23 ` Harshit Mogalapalli
0 siblings, 1 reply; 2+ messages in thread
From: Harshit Mogalapalli @ 2024-04-02 11:17 UTC (permalink / raw)
To: Boris Brezillon, Steven Price, Liviu Dudau, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
Heiko Stuebner, dri-devel, linux-kernel
Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli
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);
+
+ if (frag_end > vt_end || vt_end >= vt_start) {
ret = -EINVAL;
} else {
/* We do the allocation without holding the scheduler lock to avoid
--
2.39.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/panthor: Fix IS_ERR() vs NULL bug in group_process_tiler_oom()
2024-04-02 11:17 [PATCH] drm/panthor: Fix IS_ERR() vs NULL bug in group_process_tiler_oom() Harshit Mogalapalli
@ 2024-04-02 11:23 ` Harshit Mogalapalli
0 siblings, 0 replies; 2+ messages in thread
From: Harshit Mogalapalli @ 2024-04-02 11:23 UTC (permalink / raw)
To: Boris Brezillon, Steven Price, Liviu Dudau, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
Heiko Stuebner, dri-devel, linux-kernel
Cc: dan.carpenter, kernel-janitors, error27
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-02 11:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-02 11:17 [PATCH] drm/panthor: Fix IS_ERR() vs NULL bug in group_process_tiler_oom() Harshit Mogalapalli
2024-04-02 11:23 ` Harshit Mogalapalli
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®