Commit 82e1b93a authored by Christian König's avatar Christian König

dma-buf: use struct_size macro

Instead of manually calculating the structure size.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/394252/
parent 1a11a88c
...@@ -63,7 +63,7 @@ static struct dma_resv_list *dma_resv_list_alloc(unsigned int shared_max) ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment