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
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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;