dma-buf: use struct_size macro

Instead of manually calculating the structure size.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/394252/
This commit is contained in:
Christian König 2020-10-08 10:03:22 +02:00
parent 1a11a88cfd
commit 82e1b93ad8
1 changed files with 1 additions and 1 deletions

View File

@ -63,7 +63,7 @@ static struct dma_resv_list *dma_resv_list_alloc(unsigned int shared_max)
{ {
struct dma_resv_list *list; struct dma_resv_list *list;
list = kmalloc(offsetof(typeof(*list), shared[shared_max]), GFP_KERNEL); list = kmalloc(struct_size(list, shared, shared_max), GFP_KERNEL);
if (!list) if (!list)
return NULL; return NULL;