Commit 4ba60963 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Commit Bot

media/gpu/v4l2: do not use aggregate initializer for v4l2_format

C++ aggregate initializers will only initializer the first member
of a union, which in the case of v4l2_format leaves a lot of data
uninitialized. Fix this by initializing it with memset().

BUG=chromium:1068447
BUG=b:153935975
TEST=VDAtest passes on nyan_kitty.

Change-Id: I7138b49780a9845ea924be00f11ccaa7a6904f6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2147399Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758854}
parent 761bbfa3
...@@ -886,7 +886,8 @@ base::Optional<struct v4l2_format> V4L2Queue::SetFormat(uint32_t fourcc, ...@@ -886,7 +886,8 @@ base::Optional<struct v4l2_format> V4L2Queue::SetFormat(uint32_t fourcc,
} }
std::pair<base::Optional<struct v4l2_format>, int> V4L2Queue::GetFormat() { std::pair<base::Optional<struct v4l2_format>, int> V4L2Queue::GetFormat() {
struct v4l2_format format = {}; struct v4l2_format format;
memset(&format, 0, sizeof(format));
format.type = type_; format.type = type_;
if (device_->Ioctl(VIDIOC_G_FMT, &format) != 0) { if (device_->Ioctl(VIDIOC_G_FMT, &format) != 0) {
VPQLOGF(2) << "Failed to get format"; VPQLOGF(2) << "Failed to get format";
......
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