[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFhGd8oZy5aKjp-mVhh2d3U3tzTMzVRAfE039gvBACC0AdDNQw@mail.gmail.com>
Date: Thu, 9 May 2024 15:04:07 -0700
From: Justin Stitt <justinstitt@...gle.com>
To: Jiri Slaby <jirislaby@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Nathan Chancellor <nathan@...nel.org>,
Bill Wendling <morbo@...gle.com>, linux-kernel@...r.kernel.org,
linux-serial@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] tty: vt: saturate scrollback_delta to avoid overflow
On Thu, May 9, 2024 at 3:01 PM Justin Stitt <justinstitt@...gle.com> wrote:
>
>
> Agreed.
>
> Does an implementation like this look any better?
>
> static inline void scrolldelta(int lines)
> {
> ...
> /* saturate scrollback_delta so that it never wraps around */
> if (lines > 0)
> scrollback_delta = min(scrollback_delta, INT_MAX -
> lines) + lines;
> else
> scrollback_delta = max(scrollback_delta, INT_MIN -
> lines) + lines;
> schedule_console_callback();
> }
I apologize for this formatting, gmail ate my tabs.
Note to self, do NOT copy/paste from vim to gmail's web client.
> Thanks
> Justin
Powered by blists - more mailing lists