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 v2] serial: 8250_pci1xxxx: fix off by one in pci1xxxx_process_read_data()
Date: Wed, 10 Jan 2024 14:46:05 -0500 [thread overview]
Message-ID: <20240110144605.2a8813d4bfaff1a55edb9938@hugovil.com> (raw)
In-Reply-To: <ZZ7vIfj7Jgh-pJn8@moroto>
Hi,
it is not simply a matter of adding "fix" to the title.
You must explain what and why vs. how.
Please see:
https://cbea.ms/git-commit/#why-not-how
for some guidelines on writing a good commit message.
Hugo Villeneuve
On Wed, 10 Jan 2024 22:25:21 +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 rx_buff[] buffer has RX_BUF_SIZE
> elements. Fix the buffer overflow.
>
> 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>
> ---
> v2: Add "fix" to the subject. Fix a typo in the commit message as well.
>
> 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:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 19:25 Dan Carpenter
2024-01-10 19:46 ` Hugo Villeneuve [this message]
2024-01-10 20:07 ` Greg Kroah-Hartman
2024-01-10 20:19 ` Dan Carpenter
2024-01-10 22:41 ` Hugo Villeneuve
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=20240110144605.2a8813d4bfaff1a55edb9938@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®