mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
media: vivid: fix wrong pixel_array control size
The pixel_array control size was calculated incorrectly:
the dimensions were swapped (dims[0] should be the height), and the
values should be the width or height divided by PIXEL_ARRAY_DIV
and rounded up. So don't use roundup, but use DIV_ROUND_UP instead.
This bug is harmless in the sense that nothing will break, except that
it consumes way too much memory for this control.
Fixes: 6bc7643d1b
("media: vivid: add pixel_array test control")
Cc: <stable@vger.kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
1610f15cba
commit
3e43442d49
2 changed files with 4 additions and 3 deletions
|
@ -244,7 +244,8 @@ static const struct v4l2_ctrl_config vivid_ctrl_u8_pixel_array = {
|
|||
.min = 0x00,
|
||||
.max = 0xff,
|
||||
.step = 1,
|
||||
.dims = { 640 / PIXEL_ARRAY_DIV, 360 / PIXEL_ARRAY_DIV },
|
||||
.dims = { DIV_ROUND_UP(360, PIXEL_ARRAY_DIV),
|
||||
DIV_ROUND_UP(640, PIXEL_ARRAY_DIV) },
|
||||
};
|
||||
|
||||
static const struct v4l2_ctrl_config vivid_ctrl_s32_array = {
|
||||
|
|
|
@ -454,8 +454,8 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
|
|||
if (keep_controls)
|
||||
return;
|
||||
|
||||
dims[0] = roundup(dev->src_rect.width, PIXEL_ARRAY_DIV);
|
||||
dims[1] = roundup(dev->src_rect.height, PIXEL_ARRAY_DIV);
|
||||
dims[0] = DIV_ROUND_UP(dev->src_rect.height, PIXEL_ARRAY_DIV);
|
||||
dims[1] = DIV_ROUND_UP(dev->src_rect.width, PIXEL_ARRAY_DIV);
|
||||
v4l2_ctrl_modify_dimensions(dev->pixel_array, dims);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue