Skip to contentSkip to conversation

staging: axis-fifo: fix integer underflow in tx_fifo_depth

PATCH In review Vladan Kalaba 3 participants 4 messages Sep 22 – Sep 30

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: axis-fifo: fix integer underflow in tx_fifo_depth

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")
---
 drivers/staging/axis-fifo/axis-fifo.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/staging/axis-fifo/axis-fifo.c +5 -0
index 7bb35e11d1dd..066124122caa 100644
@@ -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)
Signature · 1 line
2.53.0
#1 lore raw
Quoted 7 lines · Vladan Kalaba

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")

---

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

regards,
dan carpenter

#2 lore raw
Quoted 10 lines · Dan Carpenter
Quoted 7 lines · Vladan Kalaba

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")

---

Quoted 6 lines

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

maintainer
#3 lore raw
In reply to Vladan Kalaba
Quoted 9 lines · Vladan Kalaba

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")
---
 drivers/staging/axis-fifo/axis-fifo.c | 5 +++++
 1 file changed, 5 insertions(+)

Did you forget an "Assisted-by:" tag for this?