From: Jan Beulich <jbeulich@suse.com>
To: Stefano Stabellini <sstabellini@kernel.org>, dmukhin@ford.com
Cc: xen-devel@lists.xenproject.org, andrew.cooper3@citrix.com,
anthony.perard@vates.tech, julien@xen.org, michal.orzel@amd.com,
"Roger Pau Monné" <roger@xenproject.org>
Subject: Re: [PATCH v8 6/7] xen/serial: harden serial_tx_buffer checks
Date: Wed, 12 Aug 2026 10:13:51 +0200 [thread overview]
Message-ID: <e1a3d71e-8a9f-428b-bcb6-6af3630a6b32@suse.com> (raw)
In-Reply-To: <4b040e58-9020-a519-00cb-816ce2fddaa0@kernel.org>
On 10.08.2026 22:32, Stefano Stabellini wrote:
> On Mon, 27 Jul 2026, dmukhin@ford.com wrote:
>> --- a/xen/drivers/char/serial.c
>> +++ b/xen/drivers/char/serial.c
>> @@ -523,6 +523,8 @@ void __init serial_async_transmit(struct serial_port *port)
>> return;
>> if ( serial_txbufsz < PAGE_SIZE )
>> serial_txbufsz = PAGE_SIZE;
>> + if ( serial_txbufsz > GB(2) )
>> + serial_txbufsz = CONFIG_SERIAL_TX_BUFSIZE;
>> while ( serial_txbufsz & (serial_txbufsz - 1) )
>> serial_txbufsz &= serial_txbufsz - 1;
>
> My understanding of this loop is that, given that serial_txbufsz is
> unsigned int, it is already clamping it to 2GB max
It would, yes, as long as sizeof(unsigned int) == sizeof(uint32_t). While
we certainly have many instances of that assumption in the code, I think
we're well advised to avoid adding more.
Furthermore (see related comments on patch 5) one may raise the question
whether serial_txbufsz wouldn't better be of type size_t.
What I'm uncertain about is the resetting to CONFIG_SERIAL_TX_BUFSIZE
here: When an overly huge size was requested, shouldn't we give the
biggest we permit?
Jan
next prev parent reply other threads:[~2026-08-12 8:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 6:50 [PATCH v8 0/7] xen/console: some cleanups and configurable conring size dmukhin
2026-07-28 6:50 ` [PATCH v8 1/7] xen/console: do not use XENCONS_RING_IDX in console_init_ring() dmukhin
2026-08-10 20:03 ` Stefano Stabellini
2026-07-28 6:50 ` [PATCH v8 2/7] xen/console: use 'unsigned int' in contring_{flush,puts}() dmukhin
2026-08-10 20:05 ` Stefano Stabellini
2026-08-12 10:30 ` Jan Beulich
2026-08-13 3:17 ` dmukhin
2026-07-28 6:50 ` [PATCH v8 3/7] xen/console: switch conring runtime allocation to xvmalloc dmukhin
2026-08-10 20:19 ` Stefano Stabellini
2026-08-12 8:04 ` Jan Beulich
2026-07-28 6:50 ` [PATCH v8 4/7] xen/serial: switch txbuf " dmukhin
2026-08-10 20:22 ` Stefano Stabellini
2026-07-28 6:50 ` [PATCH v8 5/7] xen/console: use memcpy() in conring_puts() dmukhin
2026-08-10 20:24 ` Stefano Stabellini
2026-08-10 21:36 ` Stefano Stabellini
2026-08-10 21:37 ` Andrew Cooper
2026-07-28 6:50 ` [PATCH v8 6/7] xen/serial: harden serial_tx_buffer checks dmukhin
2026-08-10 20:32 ` Stefano Stabellini
2026-08-12 8:13 ` Jan Beulich [this message]
2026-07-28 6:50 ` [PATCH v8 7/7] xen/console: make console buffer size configurable dmukhin
2026-08-10 20:42 ` Stefano Stabellini
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=e1a3d71e-8a9f-428b-bcb6-6af3630a6b32@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=dmukhin@ford.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger@xenproject.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.