[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87pli26arh.fsf@intel.com>
Date: Thu, 27 Mar 2025 12:14:26 +0200
From: Jani Nikula <jani.nikula@...el.com>
To: Denis Arefev <arefev@...mel.ru>, Helge Deller <deller@....de>
Cc: Thomas Zimmermann <tzimmermann@...e.de>, linux-fbdev@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
lvc-project@...uxtesting.org
Subject: Re: [PATCH 1/1] fbdev: atyfb: Fix buffer overflow
On Thu, 27 Mar 2025, Denis Arefev <arefev@...mel.ru> wrote:
> The value LCD_MISC_CNTL is used in the 'aty_st_lcd()' function to
> calculate an index for accessing an array element of size 9.
> This may cause a buffer overflow.
The fix is to fix it, not silently brush it under the carpet.
BR,
Jani.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Denis Arefev <arefev@...mel.ru>
> ---
> drivers/video/fbdev/aty/atyfb_base.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
> index 210fd3ac18a4..93eb5eb6042b 100644
> --- a/drivers/video/fbdev/aty/atyfb_base.c
> +++ b/drivers/video/fbdev/aty/atyfb_base.c
> @@ -149,6 +149,8 @@ static const u32 lt_lcd_regs[] = {
> void aty_st_lcd(int index, u32 val, const struct atyfb_par *par)
> {
> if (M64_HAS(LT_LCD_REGS)) {
> + if ((u32)index >= ARRAY_SIZE(lt_lcd_regs))
> + return;
> aty_st_le32(lt_lcd_regs[index], val, par);
> } else {
> unsigned long temp;
> @@ -164,6 +166,8 @@ void aty_st_lcd(int index, u32 val, const struct atyfb_par *par)
> u32 aty_ld_lcd(int index, const struct atyfb_par *par)
> {
> if (M64_HAS(LT_LCD_REGS)) {
> + if ((u32)index >= ARRAY_SIZE(lt_lcd_regs))
> + return 0;
> return aty_ld_le32(lt_lcd_regs[index], par);
> } else {
> unsigned long temp;
--
Jani Nikula, Intel
Powered by blists - more mailing lists