summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox <mawilcox@microsoft.com>2018-06-07 07:57:17 -0700
committerKees Cook <keescook@chromium.org>2018-06-12 16:19:22 -0700
commitc817e6ccb2c36b8f564209d474bc6c8308c498e2 (patch)
tree8ea397160d5e13e7f4227226e1680b496df54e36
parent7654cb1ba7d0f312a6841d35d0f576db4723e8a3 (diff)
Convert v4l2 event to struct_size
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com> Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r--drivers/media/v4l2-core/v4l2-event.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c
index 968c2eb08b5a..127fe6eb91d9 100644
--- a/drivers/media/v4l2-core/v4l2-event.c
+++ b/drivers/media/v4l2-core/v4l2-event.c
@@ -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++)