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] [thread-next>] [day] [month] [year] [list]
Message-ID: <629b305a-bc9c-7dfa-907-c96d7e676f74@linux.intel.com>
Date:   Thu, 12 Jan 2023 12:00:06 +0200 (EET)
From:   Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To:     "Jiri Slaby (SUSE)" <jirislaby@...nel.org>
cc:     gregkh@...uxfoundation.org, Kees Cook <keescook@...omium.org>,
        linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 11/11] tty: vt: cache row count in con_scroll()

On Thu, 12 Jan 2023, Jiri Slaby (SUSE) wrote:

> It's used on few places, so make the code easier to follow by caching
> the subtraction result.
> 
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@...nel.org>
> ---
>  drivers/tty/vt/vt.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 165c81211bdc..671304b31f9f 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -561,10 +561,11 @@ static void con_scroll(struct vc_data *vc, unsigned int top,
>  		       unsigned int bottom, enum con_scroll dir,
>  		       unsigned int nr)
>  {
> +	unsigned int rows = bottom - top;
>  	u16 *clear, *dst, *src;
>  
>  	if (top + nr >= bottom)
> -		nr = bottom - top - 1;
> +		nr = rows - 1;
>  	if (bottom > vc->vc_rows || top >= bottom || nr < 1)
>  		return;
>  
> @@ -577,10 +578,10 @@ static void con_scroll(struct vc_data *vc, unsigned int top,
>  	dst = (u16 *)(vc->vc_origin + vc->vc_size_row * (top + nr));
>  
>  	if (dir == SM_UP) {
> -		clear = src + (bottom - top - nr) * vc->vc_cols;
> +		clear = src + (rows - nr) * vc->vc_cols;
>  		swap(src, dst);
>  	}
> -	scr_memmovew(dst, src, (bottom - top - nr) * vc->vc_size_row);
> +	scr_memmovew(dst, src, (rows - nr) * vc->vc_size_row);
>  	scr_memsetw(clear, vc->vc_video_erase_char, vc->vc_size_row * nr);
>  }
>  
> 

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>

-- 
 i.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ