mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Aleksandr Burakov <a.burakov@rosalinux.ru>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: <lvc-project@linuxtesting.org>, <linux-kernel@vger.kernel.org>,
	<lvc-patches@linuxtesting.org>, <linux-media@vger.kernel.org>
Subject: Re: [lvc-patches] [PATCH] V4L/DVB (13661): rj54n1cb0c: possible integer overflow fix
Date: Wed, 18 Sep 2024 12:05:01 +0300	[thread overview]
Message-ID: <07673b5f-eb7d-167b-d523-230f725e0d11@omp.ru> (raw)
In-Reply-To: <20240917140454.7880-1-a.burakov@rosalinux.ru>

On 9/17/24 17:04, Aleksandr Burakov wrote:

> An integer overflow may occur due to arithmetic operation
> (multiplication) between value '314572800' and variable 'resize',
> where the value comes from '12 * RJ54N1_MAX_WIDTH * (1 << 14)' 
> and when 'resize' is equal to 16319.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: a6b5f2008a3d ("V4L/DVB (13661): rj54n1cb0c: Add cropping, auto white balance, restrict sizes, add platform data")
> Signed-off-by: Aleksandr Burakov <a.burakov@rosalinux.ru>
> ---
>  drivers/media/i2c/rj54n1cb0c.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/rj54n1cb0c.c b/drivers/media/i2c/rj54n1cb0c.c
> index a59db10153cd..a612ec1e7157 100644
> --- a/drivers/media/i2c/rj54n1cb0c.c
> +++ b/drivers/media/i2c/rj54n1cb0c.c
> @@ -776,8 +776,8 @@ static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h,
>  	}
>  
>  	/* Antiflicker */
> -	peak = 12 * RJ54N1_MAX_WIDTH * (1 << 14) * resize / rj54n1->tgclk_mhz /
> -		10000;
> +	peak = 12 * RJ54N1_MAX_WIDTH * resize / rj54n1->tgclk_mhz / 10000;
> +	peak = peak * (1 << 14);

	peak *= 1 << 14;

[...]

MBR, Sergey

      reply	other threads:[~2024-09-18  9:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-17 14:04 Aleksandr Burakov
2024-09-18  9:05 ` Sergey Shtylyov [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=07673b5f-eb7d-167b-d523-230f725e0d11@omp.ru \
    --to=s.shtylyov@omp.ru \
    --cc=a.burakov@rosalinux.ru \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lvc-patches@linuxtesting.org \
    --cc=lvc-project@linuxtesting.org \
    --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®