From: Dan Carpenter <dan.carpenter@linaro.org>
To: Jack Zhu <jack.zhu@starfivetech.com>
Cc: Changhuang Liang <changhuang.liang@starfivetech.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] media: staging: starfive: camss: fix off by one in isp_enum_mbus_code()
Date: Tue, 28 Nov 2023 17:40:14 +0300 [thread overview]
Message-ID: <7d222638-2d19-466d-8dd4-9e1ceb1d46f3@moroto.mountain> (raw)
These > comparisons should be >=. The formats->fmts[] array is either
a pointer to isp_formats_sink[] or isp_formats_source[] respectively.
Fixes: e57854628f58 ("media: staging: media: starfive: camss: Add ISP driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/staging/media/starfive/camss/stf-isp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/starfive/camss/stf-isp.c b/drivers/staging/media/starfive/camss/stf-isp.c
index 893dbd8cddc8..98d61d71c31b 100644
--- a/drivers/staging/media/starfive/camss/stf-isp.c
+++ b/drivers/staging/media/starfive/camss/stf-isp.c
@@ -120,7 +120,7 @@ static int isp_enum_mbus_code(struct v4l2_subdev *sd,
const struct stf_isp_format_table *formats;
if (code->pad == STF_ISP_PAD_SINK) {
- if (code->index > ARRAY_SIZE(isp_formats_sink))
+ if (code->index >= ARRAY_SIZE(isp_formats_sink))
return -EINVAL;
formats = &isp_dev->formats[SINK_FORMATS_INDEX];
@@ -128,7 +128,7 @@ static int isp_enum_mbus_code(struct v4l2_subdev *sd,
} else {
struct v4l2_mbus_framefmt *sink_fmt;
- if (code->index > ARRAY_SIZE(isp_formats_source))
+ if (code->index >= ARRAY_SIZE(isp_formats_source))
return -EINVAL;
sink_fmt = v4l2_subdev_state_get_format(state,
--
2.42.0
next reply other threads:[~2023-11-28 14:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 14:40 Dan Carpenter [this message]
2023-11-29 2:10 ` Changhuang Liang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7d222638-2d19-466d-8dd4-9e1ceb1d46f3@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=changhuang.liang@starfivetech.com \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jack.zhu@starfivetech.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®