From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Jiri Slaby <jirislaby@kernel.org>, Bill Wendling <morbo@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Nathan Chancellor <nathan@kernel.org>,
Kees Cook <keescook@chromium.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Justin Stitt <justinstitt@google.com>,
linux-serial@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-hardening@vger.kernel.org, llvm@lists.linux.dev,
patches@lists.linux.dev, stable@vger.kernel.org
Subject: Re: [PATCH] tty: mxser: Remove __counted_by from mxser_board.ports[]
Date: Wed, 12 Jun 2024 14:04:31 -0600 [thread overview]
Message-ID: <c80e41e6-793e-4311-8e15-f5eda91e723e@embeddedor.com> (raw)
In-Reply-To: <4da5ba72-6dff-46f1-b596-158c62b34f18@embeddedor.com>
On 6/3/24 02:26, Gustavo A. R. Silva wrote:
>
>> FWIW undoing:
>> commit 7391ee16950e772076d321792d9fbf030f921345
>> Author: Peter Hurley <peter@hurleysoftware.com>
>> Date: Sat Jun 15 09:36:07 2013 -0400
>>
>> tty: Simplify flip buffer list with 0-sized sentinel
>>
>>
>> would do the job, IMO.
>
> So, not even _sentinel_ is actually needed? Awesome!
>
It seems that a clean revert is not possible at this point, as
the original patch is more than a decade old. If _sentinel_ is
not needed, and based on the original patch, would the following
suffice?
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 79f0ff94ce00..1b77019cc510 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -135,10 +135,7 @@ void tty_buffer_free_all(struct tty_port *port)
llist_for_each_entry_safe(p, next, llist, free)
kfree(p);
- tty_buffer_reset(&buf->sentinel, 0);
- buf->head = &buf->sentinel;
- buf->tail = &buf->sentinel;
-
+ buf->tail = NULL;
still_used = atomic_xchg(&buf->mem_used, 0);
WARN(still_used != freed, "we still have not freed %d bytes!",
still_used - freed);
@@ -578,9 +575,8 @@ void tty_buffer_init(struct tty_port *port)
struct tty_bufhead *buf = &port->buf;
mutex_init(&buf->lock);
- tty_buffer_reset(&buf->sentinel, 0);
- buf->head = &buf->sentinel;
- buf->tail = &buf->sentinel;
+ buf->head = NULL;
+ buf->tail = NULL;
init_llist_head(&buf->free);
atomic_set(&buf->mem_used, 0);
atomic_set(&buf->priority, 0);
diff --git a/include/linux/tty_buffer.h b/include/linux/tty_buffer.h
index 31125e3be3c5..75fb041e43fe 100644
--- a/include/linux/tty_buffer.h
+++ b/include/linux/tty_buffer.h
@@ -37,7 +37,6 @@ struct tty_bufhead {
struct work_struct work;
struct mutex lock;
atomic_t priority;
- struct tty_buffer sentinel;
struct llist_head free; /* Free queue head */
atomic_t mem_used; /* In-use buffers excluding free list */
int mem_limit;
Thanks
--
Gustavo
next prev parent reply other threads:[~2024-06-12 20:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 21:29 [PATCH] tty: mxser: Remove __counted_by from mxser_board.ports[] Nathan Chancellor
2024-05-30 6:22 ` Jiri Slaby
2024-05-30 7:40 ` Greg Kroah-Hartman
2024-05-30 8:12 ` Gustavo A. R. Silva
2024-05-30 8:33 ` Jiri Slaby
2024-05-30 8:41 ` Jiri Slaby
2024-05-30 8:43 ` Bill Wendling
2024-05-30 8:46 ` Gustavo A. R. Silva
2024-06-03 6:07 ` Jiri Slaby
2024-06-03 8:26 ` Gustavo A. R. Silva
2024-06-12 20:04 ` Gustavo A. R. Silva [this message]
2024-05-30 8:42 ` Gustavo A. R. Silva
2024-05-30 17:43 ` Nathan Chancellor
2024-06-27 17:14 ` Kees Cook
2024-06-28 2:51 ` Gustavo A. R. Silva
2024-06-28 14:31 ` Greg Kroah-Hartman
2024-06-28 15:58 ` Kees Cook
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=c80e41e6-793e-4311-8e15-f5eda91e723e@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=gregkh@linuxfoundation.org \
--cc=gustavoars@kernel.org \
--cc=imx@lists.linux.dev \
--cc=jirislaby@kernel.org \
--cc=justinstitt@google.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=patches@lists.linux.dev \
--cc=stable@vger.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