提交 bd0b5a35 编写于 作者: D Dan Carpenter 提交者: Mauro Carvalho Chehab

media: sr030pc30: prevent array underflow in try_fmt()

Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 8f0aa382
......@@ -511,13 +511,16 @@ static int sr030pc30_get_fmt(struct v4l2_subdev *sd,
static const struct sr030pc30_format *try_fmt(struct v4l2_subdev *sd,
struct v4l2_mbus_framefmt *mf)
{
int i = ARRAY_SIZE(sr030pc30_formats);
int i;
sr030pc30_try_frame_size(mf);
while (i--)
for (i = 0; i < ARRAY_SIZE(sr030pc30_formats); i++) {
if (mf->code == sr030pc30_formats[i].code)
break;
}
if (i == ARRAY_SIZE(sr030pc30_formats))
i = 0;
mf->code = sr030pc30_formats[i].code;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册