Convert v4l2 event to struct_size

Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
Matthew Wilcox 2018-06-07 07:57:17 -07:00 committed by Kees Cook
parent 7654cb1ba7
commit c817e6ccb2
1 changed files with 1 additions and 2 deletions

View File

@ -215,8 +215,7 @@ int v4l2_event_subscribe(struct v4l2_fh *fh,
if (elems < 1)
elems = 1;
sev = kvzalloc(sizeof(*sev) + sizeof(struct v4l2_kevent) * elems,
GFP_KERNEL);
sev = kvzalloc(struct_size(sev, events, elems), GFP_KERNEL);
if (!sev)
return -ENOMEM;
for (i = 0; i < elems; i++)