[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <239b3d75-6186-3c3c-91bb-7ec46545f345@linux.intel.com>
Date: Thu, 12 Jan 2023 11:42:53 +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 07/11] tty: vt: replace BUG_ON() by WARN_ON_ONCE()
On Thu, 12 Jan 2023, Jiri Slaby (SUSE) wrote:
> No need to panic in vc_uniscr_copy_line(), just warn. This should never
> happen though, as vc_uniscr_check() is supposed to be called before
> vc_uniscr_copy_line(). And the former checks vc->vc_uni_lines already.
>
> In any case, use _ONCE as vc_uniscr_copy_line() is called repeatedly for
> each line. So don't flood the logs, just in case.
>
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@...nel.org>
> ---
> drivers/tty/vt/vt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 119b3eafef59..db72375141b0 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -535,7 +535,8 @@ void vc_uniscr_copy_line(const struct vc_data *vc, void *dest, bool viewed,
> int offset = row * vc->vc_size_row + col * 2;
> unsigned long pos;
>
> - BUG_ON(!uni_lines);
> + if (WARN_ON_ONCE(!uni_lines))
> + return;
>
> pos = (unsigned long)screenpos(vc, offset, viewed);
> if (pos >= vc->vc_origin && pos < vc->vc_scr_end) {
>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
--
i.
Powered by blists - more mailing lists