This is an automatic generated email to let you know that the following patch were queued:
Subject: media: sr030pc30: prevent array underflow in try_fmt() Author: Dan Carpenter <dan.carpen...@oracle.com> Date: Thu Jan 25 09:15:25 2018 -0500 Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mche...@s-opensource.com> drivers/media/i2c/sr030pc30.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/i2c/sr030pc30.c b/drivers/media/i2c/sr030pc30.c index 0bf031b7e4fa..2a4882cddc51 100644 --- a/drivers/media/i2c/sr030pc30.c +++ b/drivers/media/i2c/sr030pc30.c @@ -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; _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits