[PATCH] staging: axis-fifo: fix integer underflow in tx_fifo_depth
From: Vladan Kalaba
Date: Tue Sep 22 2026 - 17:59:16 EST
Fix integer underflow if tx_fifo_depth < 4 in axis-fifo.c due
to check in axis_fifo_write() subtracting 4.
Fixes: 52ff2b840bc7 ("staging: axis-fifo: fix maximum TX packet length check")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Vladan Kalaba <vladan.kalaba@xxxxxxxxx>
---
drivers/staging/axis-fifo/axis-fifo.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
index 7bb35e11d1dd..066124122caa 100644
--- a/drivers/staging/axis-fifo/axis-fifo.c
+++ b/drivers/staging/axis-fifo/axis-fifo.c
@@ -413,6 +413,11 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)
if (ret)
return ret;
+ if (fifo->tx_fifo_depth < 4) {
+ dev_err(fifo->dt_device, "tx_fifo_depth must be >= 4\n");
+ return -EINVAL;
+ }
+
ret = of_property_read_u32(node, "xlnx,use-rx-data",
&fifo->has_rx_fifo);
if (ret)
--
2.53.0