public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Changhuang Liang <changhuang.liang@starfivetech.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	Jack Zhu <jack.zhu@starfivetech.com>
Cc: 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: Re: [PATCH] media: staging: starfive: camss: fix off by one in isp_enum_mbus_code()
Date: Wed, 29 Nov 2023 10:10:50 +0800	[thread overview]
Message-ID: <cc617644-029e-4671-8231-a2b01627a08f@starfivetech.com> (raw)
In-Reply-To: <7d222638-2d19-466d-8dd4-9e1ceb1d46f3@moroto.mountain>



On 2023/11/28 22:40, Dan Carpenter wrote:
> 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>

Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com>

> ---
>  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,

      reply	other threads:[~2023-11-29  2:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28 14:40 [PATCH] media: staging: starfive: camss: fix off by one in isp_enum_mbus_code() Dan Carpenter
2023-11-29  2:10 ` Changhuang Liang [this message]

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=cc617644-029e-4671-8231-a2b01627a08f@starfivetech.com \
    --to=changhuang.liang@starfivetech.com \
    --cc=dan.carpenter@linaro.org \
    --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