Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Maoyi Xie <maoyixie.tju@gmail.com>
Cc: Christian Vogel <vogelchr@vogel.cx>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] w1: ds2490: bound the search results to the found_ids array
Date: Tue, 17 Nov 2026 15:58:10 +0100	[thread overview]
Message-ID: <51570131-ef39-4571-8ef0-22cf94ee5ca6@kernel.org> (raw)
In-Reply-To: <20261117145534.755665-1-maoyixie.tju@gmail.com>

On 17/11/2026 15:55, Maoyi Xie wrote:
> ds9490r_search() queues the ids from the DS2490 in found_ids, which has
> max_slave_count entries. max_slave_count is also the search limit. With
> more devices than that on the bus, the DS2490 sends that many ids and
> then a discrepancy value, as the comment in the function says.
> 
> The break at the limit leaves the loop over the current bulk read, but
> the outer loop keeps reading until the device is idle. A discrepancy
> value in a later bulk read is then stored in found_ids[max_slave_count],
> one past the end, and the callback loop reads it back as an id. If the
> device sends more values, they are written past the array too.
> 
> Store an id only if it fits and pass at most max_slave_count ids to the
> callback. found can still reach max_slave_count + 1, so the check after
> the loop sees that more devices remain. Use one local copy of
> max_slave_count for the allocation and the bound.
> 
> I found this with a static analysis tool that we are developing. A

LLM is not static analysis.

Just say you use Claude or other LLM in changelog, not commit msg.


> userspace harness runs an unmodified copy of ds9490r_search() from
> v7.4-rc3 against a fake DS2490. With the default max_slave_count of 64,

You need to test linux-next. There were several fixes for w1 recently.

Best regards,
Krzysztof

      reply	other threads:[~2026-11-17 14:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 14:55 [PATCH] w1: ds2490: bound the search results to the found_ids array Maoyi Xie
2026-11-17 14:58 ` Krzysztof Kozlowski [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=51570131-ef39-4571-8ef0-22cf94ee5ca6@kernel.org \
    --to=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maoyixie.tju@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=vogelchr@vogel.cx \
    /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