xen: use struct_size() helper in kzalloc()

struct privcmd_buf_vma_private has a zero-sized array at the end
(pages), use the new struct_size() helper to determine the proper
allocation size and avoid potential type mistakes.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>

authored by

Andrea Righi and committed by
Juergen Gross
ad94dc3a 0266def9

+1 -2
+1 -2
drivers/xen/privcmd-buf.c
··· 140 if (!(vma->vm_flags & VM_SHARED)) 141 return -EINVAL; 142 143 - vma_priv = kzalloc(sizeof(*vma_priv) + count * sizeof(void *), 144 - GFP_KERNEL); 145 if (!vma_priv) 146 return -ENOMEM; 147
··· 140 if (!(vma->vm_flags & VM_SHARED)) 141 return -EINVAL; 142 143 + vma_priv = kzalloc(struct_size(vma_priv, pages, count), GFP_KERNEL); 144 if (!vma_priv) 145 return -ENOMEM; 146