Skip to contentSkip to conversation

drm/syncobj: Use kmalloc_objs for chains

PATCH In review Jonathan Cavitt 2 participants 2 messages Jul 1

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

PATCH 1/1 drm/syncobj: Use kmalloc_objs for chains

Use kmalloc_objs instead of kmalloc_array when initializing chains in drm_syncobj_timeline_signal_ioctl.

Concern caught by static analysis.

Cc Tobias Hector <[email protected]>
Cc Jason Ekstrand <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Chunming Zhou <[email protected]>
Cc Lionel Landwerlin <[email protected]>
---
 drivers/gpu/drm/drm_syncobj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_syncobj.c +1 -1
index c9dbf64c0c9f..2fa170a29a62 100644
@@ -1619,7 +1619,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
 		goto err_points;
 	}
 
-	chains = kmalloc_array(args->count_handles, sizeof(void *), GFP_KERNEL);
+	chains = kmalloc_objs(*chains, args->count_handles, GFP_KERNEL);
 	if (!chains) {
 		ret = -ENOMEM;
 		goto err_points;
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jonathan Cavitt

Use kmalloc_objs instead of kmalloc_array when initializing chains in drm_syncobj_timeline_signal_ioctl.

Concern caught by static analysis.

Quoted 8 lines
Cc Tobias Hector <[email protected]>
Cc Jason Ekstrand <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Chunming Zhou <[email protected]>
Cc Lionel Landwerlin <[email protected]>
Quoted 17 lines
---
 drivers/gpu/drm/drm_syncobj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_syncobj.c +1 -1
index c9dbf64c0c9f..2fa170a29a62 100644
@@ -1619,7 +1619,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
 		goto err_points;
 	}
 
-	chains = kmalloc_array(args->count_handles, sizeof(void *), GFP_KERNEL);
+	chains = kmalloc_objs(*chains, args->count_handles, GFP_KERNEL);
 	if (!chains) {
 		ret = -ENOMEM;
 		goto err_points;