lkml.org 
[lkml]   [2024]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] drm/panthor: Fix IS_ERR() vs NULL bug in group_process_tiler_oom()
Date
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

\
 
 \ /
  Last update: 2024-05-27 16:19    [W:4.080 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site