Commit 7c8a940a authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: v4l2-subdev: clear reserved fields

Clear the reserved fields for these ioctls according to the specification:

VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
VIDIOC_SUBDEV_ENUM_FRAME_SIZE
VIDIOC_SUBDEV_ENUM_MBUS_CODE
VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP
VIDIOC_SUBDEV_G_FMT, VIDIOC_SUBDEV_S_FMT
VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL
VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION

Found with v4l2-compliance.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 29422737
...@@ -260,6 +260,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -260,6 +260,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
if (rval) if (rval)
return rval; return rval;
memset(format->reserved, 0, sizeof(format->reserved));
memset(format->format.reserved, 0, sizeof(format->format.reserved));
return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->pad, format); return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->pad, format);
} }
...@@ -270,6 +272,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -270,6 +272,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
if (rval) if (rval)
return rval; return rval;
memset(format->reserved, 0, sizeof(format->reserved));
memset(format->format.reserved, 0, sizeof(format->format.reserved));
return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->pad, format); return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->pad, format);
} }
...@@ -281,6 +285,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -281,6 +285,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
if (rval) if (rval)
return rval; return rval;
memset(crop->reserved, 0, sizeof(crop->reserved));
memset(&sel, 0, sizeof(sel)); memset(&sel, 0, sizeof(sel));
sel.which = crop->which; sel.which = crop->which;
sel.pad = crop->pad; sel.pad = crop->pad;
...@@ -298,6 +303,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -298,6 +303,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
struct v4l2_subdev_crop *crop = arg; struct v4l2_subdev_crop *crop = arg;
struct v4l2_subdev_selection sel; struct v4l2_subdev_selection sel;
memset(crop->reserved, 0, sizeof(crop->reserved));
rval = check_crop(sd, crop); rval = check_crop(sd, crop);
if (rval) if (rval)
return rval; return rval;
...@@ -326,6 +332,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -326,6 +332,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
if (code->pad >= sd->entity.num_pads) if (code->pad >= sd->entity.num_pads)
return -EINVAL; return -EINVAL;
memset(code->reserved, 0, sizeof(code->reserved));
return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->pad, return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->pad,
code); code);
} }
...@@ -340,6 +347,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -340,6 +347,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
if (fse->pad >= sd->entity.num_pads) if (fse->pad >= sd->entity.num_pads)
return -EINVAL; return -EINVAL;
memset(fse->reserved, 0, sizeof(fse->reserved));
return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->pad, return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->pad,
fse); fse);
} }
...@@ -350,6 +358,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -350,6 +358,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
if (fi->pad >= sd->entity.num_pads) if (fi->pad >= sd->entity.num_pads)
return -EINVAL; return -EINVAL;
memset(fi->reserved, 0, sizeof(fi->reserved));
return v4l2_subdev_call(sd, video, g_frame_interval, arg); return v4l2_subdev_call(sd, video, g_frame_interval, arg);
} }
...@@ -359,6 +368,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -359,6 +368,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
if (fi->pad >= sd->entity.num_pads) if (fi->pad >= sd->entity.num_pads)
return -EINVAL; return -EINVAL;
memset(fi->reserved, 0, sizeof(fi->reserved));
return v4l2_subdev_call(sd, video, s_frame_interval, arg); return v4l2_subdev_call(sd, video, s_frame_interval, arg);
} }
...@@ -372,6 +382,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -372,6 +382,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
if (fie->pad >= sd->entity.num_pads) if (fie->pad >= sd->entity.num_pads)
return -EINVAL; return -EINVAL;
memset(fie->reserved, 0, sizeof(fie->reserved));
return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->pad, return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->pad,
fie); fie);
} }
...@@ -383,6 +394,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -383,6 +394,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
if (rval) if (rval)
return rval; return rval;
memset(sel->reserved, 0, sizeof(sel->reserved));
return v4l2_subdev_call( return v4l2_subdev_call(
sd, pad, get_selection, subdev_fh->pad, sel); sd, pad, get_selection, subdev_fh->pad, sel);
} }
...@@ -394,6 +406,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -394,6 +406,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
if (rval) if (rval)
return rval; return rval;
memset(sel->reserved, 0, sizeof(sel->reserved));
return v4l2_subdev_call( return v4l2_subdev_call(
sd, pad, set_selection, subdev_fh->pad, sel); sd, pad, set_selection, subdev_fh->pad, sel);
} }
......
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