Commit c817e6ccb2c36b8f564209d474bc6c8308c498e2
Committed by
Kees Cook
1 parent
7654cb1ba7
Convert v4l2 event to struct_size
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com> Signed-off-by: Kees Cook <keescook@chromium.org>
Showing 1 changed file with 1 additions and 2 deletions Side-by-side Diff
drivers/media/v4l2-core/v4l2-event.c
... | ... | @@ -215,8 +215,7 @@ |
215 | 215 | if (elems < 1) |
216 | 216 | elems = 1; |
217 | 217 | |
218 | - sev = kvzalloc(sizeof(*sev) + sizeof(struct v4l2_kevent) * elems, | |
219 | - GFP_KERNEL); | |
218 | + sev = kvzalloc(struct_size(sev, events, elems), GFP_KERNEL); | |
220 | 219 | if (!sev) |
221 | 220 | return -ENOMEM; |
222 | 221 | for (i = 0; i < elems; i++) |