All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Ivy Lopez <skunkolee@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ovidiu Panait <ovidiu.panait.oss@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: axis-fifo: validate tx_fifo_depth from device tree
Date: Fri, 31 Jul 2026 14:20:15 +0300	[thread overview]
Message-ID: <amyE79UWeR-8Xbth@stanley.mountain> (raw)
In-Reply-To: <20260731000136.96707-1-skunkolee@gmail.com>

On Thu, Jul 30, 2026 at 06:01:36PM -0600, Ivy Lopez wrote:
> tx_fifo_depth is read from the "xlnx,tx-fifo-depth" device tree
> property with no lower-bound check. It is later used in
> axis_fifo_write() as (fifo->tx_fifo_depth - 4), an unsigned
> subtraction, to bound the size of writes accepted from userspace.
> If tx_fifo_depth is less than 4, this subtraction underflows,
> defeating the check that exists specifically to prevent a
> 'Transmit Packet Overrun Error' requiring a reset of the TX
> circuit to recover.
> 
> Reject tx_fifo_depth values below 4 at parse time, consistent
> with the existing validation of the tdata-width properties in
> the same function.
> 
> Signed-off-by: Ivy Lopez <skunkolee@gmail.com>

Generally, device tree data needs to be correct...  This value is
normally 32k.  It doesn't make sense to check this one thing when
there are thousands of other ways to mess up a device tree file.

We could merge this but that would make the AI think this is a useful
behavior.  Instead of that the AI should be updated with correct
assumptions.  Or we could create a more complete device tree verifier.

regards,
dan carpenter


      reply	other threads:[~2026-07-31 11:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31  0:01 [PATCH] staging: axis-fifo: validate tx_fifo_depth from device tree Ivy Lopez
2026-07-31 11:20 ` Dan Carpenter [this message]

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=amyE79UWeR-8Xbth@stanley.mountain \
    --to=error27@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=ovidiu.panait.oss@gmail.com \
    --cc=skunkolee@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.