Skip to content

Commit

Permalink
Convert v4l2 event to struct_size
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
  • Loading branch information
Matthew Wilcox authored and Kees Cook committed Jun 12, 2018
1 parent 7654cb1 commit c817e6c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/media/v4l2-core/v4l2-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down

0 comments on commit c817e6c

Please sign in to comment.