diff options
author | Matthew Wilcox <mawilcox@microsoft.com> | 2018-06-07 17:57:18 +0300 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2018-06-13 02:19:22 +0300 |
commit | b2303d7bf76d36a5176c793df628d302be29ab82 (patch) | |
tree | 026b2c5394540f7e11042f2ecfa9ceed4ffa826a /drivers | |
parent | c817e6ccb2c36b8f564209d474bc6c8308c498e2 (diff) | |
download | linux-b2303d7bf76d36a5176c793df628d302be29ab82.tar.xz |
Convert vhost to struct_size
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/vhost/vhost.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 895eaa25807c..f9bce818da11 100644 --- 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; |