mirror of https://gitee.com/openkylin/linux.git
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:
parent
1a11a88cfd
commit
82e1b93ad8
|
@ -63,7 +63,7 @@ static struct dma_resv_list *dma_resv_list_alloc(unsigned int shared_max)
|
|||
{
|
||||
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)
|
||||
return NULL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue