Skip to contentSkip to conversation

drm/exec: Use kvmalloc_objs for exec->objects

PATCH In review Jonathan Cavitt 2 participants 2 messages Jul 1 – Jul 2

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/exec: Use kvmalloc_objs for exec->objects

Use kvmalloc_objs instead of kvmalloc_array when initializing exec->objects in drm_exec_init.

Concern caught by static analysis.

Cc Rob Clark <[email protected]>
Cc Christian König <[email protected]>
---
 drivers/gpu/drm/drm_exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_exec.c +1 -1
index 7988f5e7d56a..fa923852fae4 100644
@@ -79,7 +79,7 @@ void drm_exec_init(struct drm_exec *exec, u32 flags, unsigned nr)
 		nr = PAGE_SIZE / sizeof(void *);
 
 	exec->flags = flags;
-	exec->objects = kvmalloc_array(nr, sizeof(void *), GFP_KERNEL);
+	exec->objects = kvmalloc_objs(*exec->objects, nr, GFP_KERNEL);
 
 	/* If allocation here fails, just delay that till the first use */
 	exec->max_objects = exec->objects ? nr : 0;
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jonathan Cavitt

Use kvmalloc_objs instead of kvmalloc_array when initializing exec->objects in drm_exec_init.

Concern caught by static analysis.

Cc Rob Clark <[email protected]>
Cc Christian König <[email protected]>
Quoted 17 lines
---
 drivers/gpu/drm/drm_exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_exec.c +1 -1
index 7988f5e7d56a..fa923852fae4 100644
@@ -79,7 +79,7 @@ void drm_exec_init(struct drm_exec *exec, u32 flags, unsigned nr)
 		nr = PAGE_SIZE / sizeof(void *);
 
 	exec->flags = flags;
-	exec->objects = kvmalloc_array(nr, sizeof(void *), GFP_KERNEL);
+	exec->objects = kvmalloc_objs(*exec->objects, nr, GFP_KERNEL);
 
 	/* If allocation here fails, just delay that till the first use */
 	exec->max_objects = exec->objects ? nr : 0;