Devicetree
 help / color / mirror / Atom feed
From: "Carlo Caione" <ccaione@baylibre.com>
To: "Rob Herring" <robh@kernel.org>, "Carlo Caione" <ccaione@baylibre.com>
Cc: <saravanak@kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH v2] of/address: Fix NULL bus dereference in of_pci_range_parser_one()
Date: Fri, 17 Jul 2026 13:08:44 +0200	[thread overview]
Message-ID: <DK0SS9CO8VPC.288VHJRRGAWQ2@baylibre.com> (raw)
In-Reply-To: <20260716204914.GA1262499-robh@kernel.org>

On Thu Jul 16, 2026 at 10:49 PM CEST, Rob Herring wrote:
> On Mon, Jul 06, 2026 at 01:47:17PM +0200, Carlo Caione wrote:

...  
>>  	ranges = of_get_property(np, "dma-ranges", &len);
>> -	if (ranges && len) {
>> -		of_dma_range_parser_init(&parser, np);
>> +	if (ranges && len && !of_dma_range_parser_init(&parser, np) &&
>> +	    of_range_count(&parser)) {
>
> Why do we need of_range_count() here?

too zelous but this hopefully covers the case where init succeeds but
the property holds no complete entry, so the loop never runs. E.g. a
32-bit style triplet on a 2/2-cells bus:

      soc {
              #address-cells = <2>;
              #size-cells = <2>;
              dma-ranges = <0x0 0x40000000 0x40000000>;
      };

It is unlikely and a pre-existing problem so I can drop it if you want.

cheers,

--
Carlo Caione

      reply	other threads:[~2026-07-17 11:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 11:47 [PATCH v2] of/address: Fix NULL bus dereference in of_pci_range_parser_one() Carlo Caione
2026-07-06 11:59 ` sashiko-bot
2026-07-08  9:45   ` Carlo Caione
2026-07-16 20:49 ` Rob Herring
2026-07-17 11:08   ` Carlo Caione [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=DK0SS9CO8VPC.288VHJRRGAWQ2@baylibre.com \
    --to=ccaione@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=saravanak@kernel.org \
    --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