xen: use struct_size() helper in kzalloc()
PATCH 1/1 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.
--- drivers/xen/privcmd-buf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/xen/privcmd-buf.c +1 -2
@@ -140,8 +140,7 @@ static int privcmd_buf_mmap(struct file *file, struct vm_area_struct *vma)if (!(vma->vm_flags &VM_SHARED ))return -EINVAL ; - vma_priv =kzalloc (sizeof (*vma_priv) + count *sizeof (void *), -GFP_KERNEL ); + vma_priv =kzalloc (struct_size (vma_priv, pages, count),GFP_KERNEL );if (!vma_priv)return -ENOMEM ;
Signature · 1 line
2.19.1
Quoted 5 lines · Andrea Righi
struct
privcmd_buf_vma_privatehas a zero-sized array at the end (pages), use the newstruct_size()helper to determine the proper allocation size and avoid potential type mistakes.Signed-off-by Andrea Righi <[email protected]>
Juergen
Quoted 5 lines · Andrea Righi
struct
privcmd_buf_vma_privatehas a zero-sized array at the end (pages), use the newstruct_size()helper to determine the proper allocation size and avoid potential type mistakes.Signed-off-by Andrea Righi <[email protected]>
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines · Andrea Righi
struct
privcmd_buf_vma_privatehas a zero-sized array at the end (pages), use the newstruct_size()helper to determine the proper allocation size and avoid potential type mistakes.Signed-off-by Andrea Righi <[email protected]>
Pushed to xen/tip.git for-linus-5.1b
Juergen
Quoted 5 lines · Andrea Righi
struct
privcmd_buf_vma_privatehas a zero-sized array at the end (pages), use the newstruct_size()helper to determine the proper allocation size and avoid potential type mistakes.Signed-off-by Andrea Righi <[email protected]>
Pushed to xen/tip.git for-linus-5.1b
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel