[PATCH] staging: axis-fifo: fix integer underflow in tx_fifo_depth

Vladan Kalaba posted 1 patch 1 day, 15 hours ago
drivers/staging/axis-fifo/axis-fifo.c | 5 +++++
1 file changed, 5 insertions(+)
[PATCH] staging: axis-fifo: fix integer underflow in tx_fifo_depth
Posted by Vladan Kalaba 1 day, 15 hours ago
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@vger.kernel.org
Signed-off-by: Vladan Kalaba <vladan.kalaba@gmail.com>
---
 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
Re: [PATCH] staging: axis-fifo: fix integer underflow in tx_fifo_depth
Posted by Dan Carpenter 1 day, 6 hours ago
On Tue, Sep 22, 2026 at 11:58:48PM +0200, Vladan Kalaba wrote:
> 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@vger.kernel.org
> Signed-off-by: Vladan Kalaba <vladan.kalaba@gmail.com>
> ---

This has been sent a number of times before.  The information comes
from device tree and we trust the device tree.

regards,
dan carpenter
Re: [PATCH] staging: axis-fifo: fix integer underflow in tx_fifo_depth
Posted by Vladan Kalaba 18 hours ago
On Wed, Sep 23, 2026 at 9:43 AM Dan Carpenter <error27@gmail.com> wrote:
>
> On Tue, Sep 22, 2026 at 11:58:48PM +0200, Vladan Kalaba wrote:
> > 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@vger.kernel.org
> > Signed-off-by: Vladan Kalaba <vladan.kalaba@gmail.com>
> > ---
>
> This has been sent a number of times before.  The information comes
> from device tree and we trust the device tree.
>
> regards,
> dan carpenter
>
Hi Dan,
Thanks for letting me know, I will keep that in mind in future.

Sincerely,
Vladan