[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b2986ba9-0a66-09fe-4a9a-444c113b2bbd@omp.ru>
Date: Mon, 30 Oct 2023 11:40:37 +0300
From: Sergey Shtylyov <s.shtylyov@....ru>
To: Sasha Levin <sashal@...nel.org>, <linux-kernel@...r.kernel.org>,
<stable@...r.kernel.org>
CC: Helge Deller <deller@....de>, <daniel@...ll.ch>,
<linux-fbdev@...r.kernel.org>, <dri-devel@...ts.freedesktop.org>
Subject: Re: [PATCH AUTOSEL 6.5 35/52] fbdev: core: syscopyarea: fix sloppy
typing
On 10/30/23 1:53 AM, Sasha Levin wrote:
> From: Sergey Shtylyov <s.shtylyov@....ru>
>
> [ Upstream commit e8e4a470b677511f9d1ad4f3cef32adc1d9a60ca ]
>
> In sys_copyarea(), the local variable bits_per_line is needlessly typed as
> *unsigned long* -- which is a 32-bit type on the 32-bit arches and a 64-bit
> type on the 64-bit arches; that variable's value is derived from the __u32
> typed fb_fix_screeninfo::line_length field (multiplied by 8u) and a 32-bit
> *unsigned int* type should still be enough to store the # of bits per line.
>
> Found by Linux Verification Center (linuxtesting.org) with the Svace static
> analysis tool.
>
> Signed-off-by: Sergey Shtylyov <s.shtylyov@....ru>
> Signed-off-by: Helge Deller <deller@....de>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
> ---
> drivers/video/fbdev/core/syscopyarea.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/core/syscopyarea.c b/drivers/video/fbdev/core/syscopyarea.c
> index c1eda31909682..7b8bd3a2bedc5 100644
> --- a/drivers/video/fbdev/core/syscopyarea.c
> +++ b/drivers/video/fbdev/core/syscopyarea.c
> @@ -316,7 +316,7 @@ void sys_copyarea(struct fb_info *p, const struct fb_copyarea *area)
> {
> u32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy;
> u32 height = area->height, width = area->width;
> - unsigned long const bits_per_line = p->fix.line_length*8u;
> + unsigned int const bits_per_line = p->fix.line_length * 8u;
> unsigned long *base = NULL;
> int bits = BITS_PER_LONG, bytes = bits >> 3;
> unsigned dst_idx = 0, src_idx = 0, rev_copy = 0;
This one doesn't seem necessary in the stable kernels too...
MBR, Sergey
Powered by blists - more mailing lists