提交 82e1b93a 编写于 作者: C Christian König

dma-buf: use struct_size macro

Instead of manually calculating the structure size.
Signed-off-by: NChristian König <christian.koenig@amd.com>
Reviewed-by: NGustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/394252/
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册