Subject: linux-next: build failure after merge of the tty tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 23 Jan 2023 13:18:18 +1100

Hi all,

After merging the tty tree, today's linux-next build (x86_64 allmodconfig)
failed like this:

drivers/tty/serial/qcom_geni_serial.c: In function 'setup_fifos':
drivers/tty/serial/qcom_geni_serial.c:1058:17: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
 1058 |         if (port->rx_fifo && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
      |                 ^~
drivers/tty/serial/qcom_geni_serial.c:1059:21: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
 1059 |                 port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
      |                     ^~
drivers/tty/serial/qcom_geni_serial.c:1059:63: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
 1059 |                 port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
      |                                                               ^~
drivers/tty/serial/qcom_geni_serial.c:1062:26: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
 1062 |                 if (!port->rx_fifo)
      |                          ^~

Caused by commit

  2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")

interacting with commit

  b8caf69a6946 ("tty: serial: qcom-geni-serial: fix slab-out-of-bounds on RX FIFO buffer")

from Linus' tree.

I have applied the following merge fix patch for today (I am not sure
if it is actually correct, but it builds).

From: Stephen Rothwell <[email-masked]>
Date: Mon, 23 Jan 2023 13:09:27 +1100
Subject: [PATCH] tty: fix up for "tty: serial: qcom-geni-serial: add support
 for serial engine DMA"

interacting with "tty: serial: qcom-geni-serial: fix slab-out-of-bounds
on RX FIFO buffer".

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 drivers/tty/serial/qcom_geni_serial.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index d98e0a8aae7c..61350007bf1c 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -1055,11 +1055,11 @@ static int setup_fifos(struct qcom_geni_serial_port *port)
 	uport->fifosize =
 		(port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE;
 
-	if (port->rx_fifo && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
-		port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
+	if (port->rx_buf && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
+		port->rx_buf = devm_krealloc(uport->dev, port->rx_buf,
 					      port->rx_fifo_depth * sizeof(u32),
 					      GFP_KERNEL);
-		if (!port->rx_fifo)
+		if (!port->rx_buf)
 			return -ENOMEM;
 	}
 
-- 
2.35.1

-- 
Cheers,
Stephen Rothwell