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: <f48acfdd-779d-2f6-27a5-39168e6f4ac0@linux.intel.com>
Date:   Thu, 12 Jan 2023 11:59:43 +0200 (EET)
From:   Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To:     "Jiri Slaby (SUSE)" <jirislaby@...nel.org>
cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Kees Cook <keescook@...omium.org>,
        linux-serial <linux-serial@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 10/11] tty: vt: saner names for more scroll variables

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

> Rename more variables (t, b, s, d) -> (top, bottom, src, dst) to make
> them more obvious.
> 
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@...nel.org>
> ---
>  drivers/tty/vt/vt.c | 40 ++++++++++++++++++++++------------------
>  1 file changed, 22 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 7cda18b7ee3d..165c81211bdc 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -420,21 +420,22 @@ static void juggle_array(u32 **array, unsigned int size, unsigned int nr)
>  	}
>  }
>  
> -static void vc_uniscr_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
> -			     enum con_scroll dir, unsigned int nr)
> +static void vc_uniscr_scroll(struct vc_data *vc, unsigned int top,
> +			     unsigned int bottom, enum con_scroll dir,
> +			     unsigned int nr)
>  {
>  	u32 **uni_lines = vc->vc_uni_lines;
> -	unsigned int size = b - t;
> +	unsigned int size = bottom - top;
>  
>  	if (!uni_lines)
>  		return;
>  
>  	if (dir == SM_DOWN) {
>  		juggle_array(&uni_lines[top], size, size - nr);
> -		vc_uniscr_clear_lines(vc, t, nr);
> +		vc_uniscr_clear_lines(vc, top, nr);
>  	} else {
>  		juggle_array(&uni_lines[top], size, nr);
> -		vc_uniscr_clear_lines(vc, b - nr, nr);
> +		vc_uniscr_clear_lines(vc, bottom - nr, nr);
>  	}
>  }
>  
> @@ -556,27 +557,30 @@ void vc_uniscr_copy_line(const struct vc_data *vc, void *dest, bool viewed,
>  	}
>  }
>  
> -static void con_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
> -		enum con_scroll dir, unsigned int nr)
> +static void con_scroll(struct vc_data *vc, unsigned int top,
> +		       unsigned int bottom, enum con_scroll dir,
> +		       unsigned int nr)
>  {
> -	u16 *clear, *d, *s;
> +	u16 *clear, *dst, *src;
>  
> -	if (t + nr >= b)
> -		nr = b - t - 1;
> -	if (b > vc->vc_rows || t >= b || nr < 1)
> +	if (top + nr >= bottom)
> +		nr = bottom - top - 1;
> +	if (bottom > vc->vc_rows || top >= bottom || nr < 1)
>  		return;
> -	vc_uniscr_scroll(vc, t, b, dir, nr);
> -	if (con_is_visible(vc) && vc->vc_sw->con_scroll(vc, t, b, dir, nr))
> +
> +	vc_uniscr_scroll(vc, top, bottom, dir, nr);
> +	if (con_is_visible(vc) &&
> +			vc->vc_sw->con_scroll(vc, top, bottom, dir, nr))

I'd keep this on one line.

>  		return;
>  
> -	s = clear = (u16 *)(vc->vc_origin + vc->vc_size_row * t);
> -	d = (u16 *)(vc->vc_origin + vc->vc_size_row * (t + nr));
> +	src = clear = (u16 *)(vc->vc_origin + vc->vc_size_row * top);
> +	dst = (u16 *)(vc->vc_origin + vc->vc_size_row * (top + nr));
>  
>  	if (dir == SM_UP) {
> -		clear = s + (b - t - nr) * vc->vc_cols;
> -		swap(s, d);
> +		clear = src + (bottom - top - nr) * vc->vc_cols;
> +		swap(src, dst);
>  	}
> -	scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row);
> +	scr_memmovew(dst, src, (bottom - top - 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