Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "James Hilliard" <james.hilliard1@gmail.com>
Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
	linux-sunxi@lists.linux.dev, robh@kernel.org,
	conor+dt@kernel.org
Subject: Re: [PATCH v10 03/11] serial: 8250: widen RX trigger byte counts to 16 bits
Date: Fri, 04 Dec 2026 10:46:18 +0000	[thread overview]
Message-ID: <sashiko-outbox-249626@kernel.org> (raw)
In-Reply-To: <20261204-submit-h616-uart-fifo-v1-v10-3-1a9fb4f79635@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] serial: 8250_mxpcie: u16-to-u8 truncation in
  mxpcie8250_set_rxtrig()
--

commit c0bd87c22f5fd195b99868bf224819efdd25bf4c
Author: James Hilliard <james.hilliard1@gmail.com>

serial: 8250: widen RX trigger byte counts to 16 bits

This commit widens the 8250 RX trigger threshold tables, sysfs parser,
and uart_port set_rxtrig callback from unsigned char to u16 to support
UARTs with larger FIFOs.

> diff --git a/drivers/tty/serial/8250/8250_mxpcie.c b/drivers/tty/serial/8250/8250_mxpcie.c
> index 0a3fb63991c1c..eff1643396110 100644
> --- a/drivers/tty/serial/8250/8250_mxpcie.c
> +++ b/drivers/tty/serial/8250/8250_mxpcie.c
> @@ -257,7 +257,7 @@ static int mxpcie8250_get_rxtrig(struct uart_port *port)
>  	return serial_port_in(port, MOXA_PUART_RTL);
>  }
>  
> -static int mxpcie8250_set_rxtrig(struct uart_port *port, unsigned char bytes)
> +static int mxpcie8250_set_rxtrig(struct uart_port *port, u16 bytes)
>  {
>  	struct mxpcie8250 *priv = dev_get_drvdata(port->dev);

[Severity: Low]
Can mxpcie8250_set_rxtrig() silently truncate bytes when writing
MOXA_PUART_RTL and rx_trig_level?

mxpcie8250_set_rxtrig() only checks bytes > port->fifosize, but
TIOCSSERIAL allows CAP_SYS_ADMIN to overwrite uport->fifosize via
uart_set_info() without serial8250_verify_port() validating
xmit_fifo_size, even with UPF_FIXED_TYPE set.

With rx_trig_bytes_store() now using kstrtou16(), values above 255 can
pass the fifosize check and get truncated modulo 256 when written to the
8-bit MOXA_PUART_RTL register and stored in u8 rx_trig_level (e.g.
writing 256 programs 0) while returning success.

Bounding bytes against U8_MAX (or the hardware 128-byte FIFO limit) in
mxpcie8250_set_rxtrig() would avoid the truncation.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-submit-h616-uart-fifo-v1-v10-0-1a9fb4f79635@gmail.com?part=3

  reply	other threads:[~2026-12-04 10:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 10:28 [PATCH v10 00/11] serial: 8250_dw: share RX trigger setup and describe Allwinner UARTs James Hilliard
2026-12-04 10:28 ` [PATCH v10 01/11] serial: 8250_dw: allow port setup to report errors James Hilliard
2026-12-04 10:28 ` [PATCH v10 02/11] serial: 8250_dw: select port setup through platform data James Hilliard
2026-12-04 10:28 ` [PATCH v10 03/11] serial: 8250: widen RX trigger byte counts to 16 bits James Hilliard
2026-12-04 10:46   ` sashiko-bot [this message]
2026-12-04 10:28 ` [PATCH v10 04/11] serial: 8250: share the RX trigger conversion helper James Hilliard
2026-12-04 10:28 ` [PATCH v10 05/11] serial: 8250: expose RX trigger controls for custom callbacks James Hilliard
2026-12-04 10:28 ` [PATCH v10 06/11] serial: 8250_dw: derive RX trigger thresholds from the FIFO depth James Hilliard
2026-12-04 10:52   ` sashiko-bot
2026-12-04 10:28 ` [PATCH v10 07/11] dt-bindings: serial: snps-dw-apb-uart: add Allwinner H616 James Hilliard
2026-12-04 10:28 ` [PATCH v10 08/11] serial: 8250_dw: configure the Allwinner H616 UART James Hilliard
2026-12-04 10:50   ` sashiko-bot
2026-12-04 10:28 ` [PATCH v10 09/11] dt-bindings: serial: snps-dw-apb-uart: add Allwinner A523 James Hilliard
2026-12-04 10:28 ` [PATCH v10 10/11] serial: 8250_dw: discover Allwinner A523 FIFO depths through FCC James Hilliard
2026-12-04 10:28 ` [PATCH v10 11/11] serial: 8250_dw: configure RX trigger thresholds for Octeon James Hilliard

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=sashiko-outbox-249626@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=james.hilliard1@gmail.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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