From: Justin Stitt <justinstitt@google.com>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Nathan Chancellor <nathan@kernel.org>,
Bill Wendling <morbo@google.com>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH] tty: vt: saturate scrollback_delta to avoid overflow
Date: Thu, 9 May 2024 15:04:07 -0700 [thread overview]
Message-ID: <CAFhGd8oZy5aKjp-mVhh2d3U3tzTMzVRAfE039gvBACC0AdDNQw@mail.gmail.com> (raw)
In-Reply-To: <CAFhGd8qkYYQZi37Tsj-V5pN5S4xhcyUeAZj1of2kTXG+EtVMgg@mail.gmail.com>
On Thu, May 9, 2024 at 3:01 PM Justin Stitt <justinstitt@google.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
next prev parent reply other threads:[~2024-05-09 22:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 18:55 [PATCH] tty: vt: saturate scrollback_delta to avoid overflow Justin Stitt
2024-05-09 6:31 ` Jiri Slaby
2024-05-09 22:01 ` Justin Stitt
2024-05-09 22:04 ` Justin Stitt [this message]
2024-05-10 10:40 ` Greg Kroah-Hartman
2024-05-10 16:13 ` Justin Stitt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFhGd8oZy5aKjp-mVhh2d3U3tzTMzVRAfE039gvBACC0AdDNQw@mail.gmail.com \
--to=justinstitt@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).