projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c817e6c
)
Convert vhost to struct_size
author
Matthew Wilcox
<mawilcox@microsoft.com>
Thu, 7 Jun 2018 14:57:18 +0000
(07:57 -0700)
committer
Kees Cook
<keescook@chromium.org>
Tue, 12 Jun 2018 23:19:22 +0000
(16:19 -0700)
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
drivers/vhost/vhost.c
patch
|
blob
|
history
diff --git
a/drivers/vhost/vhost.c
b/drivers/vhost/vhost.c
index 895eaa25807c84e854a19b78a9fbcfafb06dbac7..f9bce818da11f39afa7ec20e797a3b491ff6e24b 100644
(file)
--- a/
drivers/vhost/vhost.c
+++ b/
drivers/vhost/vhost.c
@@
-1286,7
+1286,8
@@
static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
return -EOPNOTSUPP;
if (mem.nregions > max_mem_regions)
return -E2BIG;
- newmem = kvzalloc(size + mem.nregions * sizeof(*m->regions), GFP_KERNEL);
+ newmem = kvzalloc(struct_size(newmem, regions, mem.nregions),
+ GFP_KERNEL);
if (!newmem)
return -ENOMEM;