mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 16:37:50 +00:00
Convert vhost to struct_size
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com> Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
parent
c817e6ccb2
commit
b2303d7bf7
1 changed files with 2 additions and 1 deletions
|
@ -1286,7 +1286,8 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
if (mem.nregions > max_mem_regions)
|
if (mem.nregions > max_mem_regions)
|
||||||
return -E2BIG;
|
return -E2BIG;
|
||||||
newmem = kvzalloc(size + mem.nregions * sizeof(*m->regions), GFP_KERNEL);
|
newmem = kvzalloc(struct_size(newmem, regions, mem.nregions),
|
||||||
|
GFP_KERNEL);
|
||||||
if (!newmem)
|
if (!newmem)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue