From: Hugo Villeneuve <hugo@hugovil.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Rengarajan S <rengarajan.s@microchip.com>,
Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>,
Tharun Kumar P <tharunkumar.pasumarthi@microchip.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] serial: 8250_pci1xxxx: off by one in pci1xxxx_process_read_data()
Date: Wed, 10 Jan 2024 14:11:46 -0500 [thread overview]
Message-ID: <20240110141146.6422e7517fe7e07a833b66df@hugovil.com> (raw)
In-Reply-To: <59f8aa13-3f88-4174-8e20-aa4467e7adac@moroto.mountain>
On Wed, 10 Jan 2024 21:52:28 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:
> These > comparisons should be >= to prevent writing one element beyond
> the end of the rx_buff[] array. The buffer has RX_BUF_SIZE[] elements.
Hi,
your commit title message is very confusing and doesn't hint that this
is a bug fix (or a potential bug fix)...
Hugo Villeneuve
>
> Fixes: aba8290f368d ("8250: microchip: pci1xxxx: Add Burst mode reception support in uart driver for writing into FIFO")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> From static analysis, not testing.
>
> drivers/tty/serial/8250/8250_pci1xxxx.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_pci1xxxx.c b/drivers/tty/serial/8250/8250_pci1xxxx.c
> index 558c4c7f3104..cd258922bd78 100644
> --- a/drivers/tty/serial/8250/8250_pci1xxxx.c
> +++ b/drivers/tty/serial/8250/8250_pci1xxxx.c
> @@ -302,7 +302,7 @@ static void pci1xxxx_process_read_data(struct uart_port *port,
> * to read, the data is received one byte at a time.
> */
> while (valid_burst_count--) {
> - if (*buff_index > (RX_BUF_SIZE - UART_BURST_SIZE))
> + if (*buff_index >= (RX_BUF_SIZE - UART_BURST_SIZE))
> break;
> burst_buf = (u32 *)&rx_buff[*buff_index];
> *burst_buf = readl(port->membase + UART_RX_BURST_FIFO);
> @@ -311,7 +311,7 @@ static void pci1xxxx_process_read_data(struct uart_port *port,
> }
>
> while (*valid_byte_count) {
> - if (*buff_index > RX_BUF_SIZE)
> + if (*buff_index >= RX_BUF_SIZE)
> break;
> rx_buff[*buff_index] = readb(port->membase +
> UART_RX_BYTE_FIFO);
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2024-01-10 19:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 18:52 Dan Carpenter
2024-01-10 19:11 ` Hugo Villeneuve [this message]
2024-01-10 19:19 ` Dan Carpenter
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=20240110141146.6422e7517fe7e07a833b66df@hugovil.com \
--to=hugo@hugovil.com \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kumaravel.thiagarajan@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=rengarajan.s@microchip.com \
--cc=tharunkumar.pasumarthi@microchip.com \
/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
all inboxes | Powered by JetHome®