mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vladan Kalaba <vladan.kalaba@gmail.com>
To: gregkh@linuxfoundation.org
Cc: ovidiu.panait.oss@gmail.com, gustavopiazdasilva2102@gmail.com,
	error27@gmail.com, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	Vladan Kalaba <vladan.kalaba@gmail.com>,
	stable@vger.kernel.org
Subject: [PATCH] staging: axis-fifo: fix integer underflow in tx_fifo_depth
Date: Tue, 22 Sep 2026 23:58:48 +0200	[thread overview]
Message-ID: <20260922215849.16739-1-vladan.kalaba@gmail.com> (raw)

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


             reply	other threads:[~2026-09-22 21:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 21:58 Vladan Kalaba [this message]
2026-09-23  6:42 ` Dan Carpenter

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=20260922215849.16739-1-vladan.kalaba@gmail.com \
    --to=vladan.kalaba@gmail.com \
    --cc=error27@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavopiazdasilva2102@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=ovidiu.panait.oss@gmail.com \
    --cc=stable@vger.kernel.org \
    /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®