lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <34994a3f-e44d-4ef1-95ee-2b2a885b3732@gmx.de>
Date:   Mon, 16 Oct 2023 23:15:28 +0200
From:   Helge Deller <deller@....de>
To:     Zhang Shurong <zhang_shurong@...mail.com>, daniel@...ll.ch
Cc:     linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fbdev: fbmon: fix potential divide error in
 fb_validate_mode

On 10/14/23 14:14, Zhang Shurong wrote:
> We can easily use FBIOPUT_VSCREENINFO set fb_var_screeninfo, so
> it's possible for a divide by zero error to occur.
>
> Fix this by making sure the divisor is non-zero before the computation.
>
> Signed-off-by: Zhang Shurong <zhang_shurong@...mail.com>
> ---
>   drivers/video/fbdev/core/fbmon.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
> index 79e5bfbdd34c..bdd15b8e3a71 100644
> --- a/drivers/video/fbdev/core/fbmon.c
> +++ b/drivers/video/fbdev/core/fbmon.c
> @@ -1470,6 +1470,9 @@ int fb_validate_mode(const struct fb_var_screeninfo *var, struct fb_info *info)
>   	if (var->vmode & FB_VMODE_DOUBLE)
>   		vtotal *= 2;
>
> +	if (!htotal || !vtotal)
> +		return -EINVAL;

This is above here:
         htotal = var->xres + var->right_margin + var->hsync_len +
                 var->left_margin;
         vtotal = var->yres + var->lower_margin + var->vsync_len +
                 var->upper_margin;

I don't see how htotal and vtotal can become zero...

Helge

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ