Skip to content
Snippets Groups Projects
Commit 562f150f authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Alex Deucher
Browse files

drm/amdgpu: Use struct_size() helper in kmalloc()


Make use of the new struct_size() helper instead of the offsetof() idiom.

Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent bae82e84
No related branches found
No related tags found
No related merge requests found
......@@ -239,8 +239,7 @@ static int amdgpu_amdkfd_remove_eviction_fence(struct amdgpu_bo *bo,
if (!old)
return 0;
new = kmalloc(offsetof(typeof(*new), shared[old->shared_max]),
GFP_KERNEL);
new = kmalloc(struct_size(new, shared, old->shared_max), GFP_KERNEL);
if (!new)
return -ENOMEM;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment