drm/amdgpu: Use struct_size() helper in kmalloc()
Make use of the new struct_size() helper instead of the offsetof() idiom. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
bae82e8418
commit
562f150fb9
@@ -239,8 +239,7 @@ static int amdgpu_amdkfd_remove_eviction_fence(struct amdgpu_bo *bo,
|
|||||||
if (!old)
|
if (!old)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
new = kmalloc(offsetof(typeof(*new), shared[old->shared_max]),
|
new = kmalloc(struct_size(new, shared, old->shared_max), GFP_KERNEL);
|
||||||
GFP_KERNEL);
|
|
||||||
if (!new)
|
if (!new)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user