diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-04-07 18:12:10 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-04-07 18:12:10 +0200 |
commit | 3b04689147085f5c8f47835d1c7e48203cba80d3 (patch) | |
tree | 09839161ab2316f923bb54f889687e9824629be7 /drivers/xen | |
parent | Merge tag 'mtd/fixes-for-5.1-rc4' of git://git.kernel.org/pub/scm/linux/kerne... (diff) | |
parent | xen: Prevent buffer overflow in privcmd ioctl (diff) | |
download | linux-3b04689147085f5c8f47835d1c7e48203cba80d3.tar.xz linux-3b04689147085f5c8f47835d1c7e48203cba80d3.zip |
Merge tag 'for-linus-5.1b-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fixes from Juergen Gross:
"One minor fix and a small cleanup for the xen privcmd driver"
* tag 'for-linus-5.1b-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen: Prevent buffer overflow in privcmd ioctl
xen: use struct_size() helper in kzalloc()
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/privcmd-buf.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/xen/privcmd-buf.c b/drivers/xen/privcmd-buf.c index de01a6d0059d..a1c61e351d3f 100644 --- a/drivers/xen/privcmd-buf.c +++ b/drivers/xen/privcmd-buf.c @@ -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; |