Commit c817e6cc authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Kees Cook

Convert v4l2 event to struct_size

Signed-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent 7654cb1b
...@@ -215,8 +215,7 @@ int v4l2_event_subscribe(struct v4l2_fh *fh, ...@@ -215,8 +215,7 @@ int v4l2_event_subscribe(struct v4l2_fh *fh,
if (elems < 1) if (elems < 1)
elems = 1; elems = 1;
sev = kvzalloc(sizeof(*sev) + sizeof(struct v4l2_kevent) * elems, sev = kvzalloc(struct_size(sev, events, elems), GFP_KERNEL);
GFP_KERNEL);
if (!sev) if (!sev)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < elems; i++) for (i = 0; i < elems; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment