mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
To: Zhihao Cheng <chengzhihao1@huawei.com>,
	David Binderman <dcb314@hotmail.com>,
	"dwmw2@infradead.org" <dwmw2@infradead.org>,
	"richard@nod.at" <richard@nod.at>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: linux-6.16/fs/jffs2/readinode.c:189: loop can never finish
Date: Mon, 4 Aug 2025 09:30:32 +0200	[thread overview]
Message-ID: <8114ae51-a238-40d3-9ecd-70e23abae28b@sigma-star.at> (raw)
In-Reply-To: <df923d94-92ee-f824-01e2-21e6ed3d593c@huawei.com>

Hi,

On 8/4/25 9:10 AM, Zhihao Cheng wrote:
> 
> The 'next != NULL' is also a condition for the loop, this snippet of code finds a leaf node in 'tn_root'.

Yes, this is a classic tree traversal. Assuming the tree isn't
broken, the loop eventually terminates when it runs of a leaf.

The real issue with this code is that this is the *only* exit
condition of the loop. The traversal loop always branches until
it hits a leaf and the function then returns NULL. I'm pretty
sure this might not be the intended behavior.

Greetings,

David


  reply	other threads:[~2025-08-04  7:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-04  6:23 David Binderman
2025-08-04  7:10 ` Zhihao Cheng
2025-08-04  7:30   ` David Oberhollenzer [this message]
2025-08-04 10:54     ` David Woodhouse

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=8114ae51-a238-40d3-9ecd-70e23abae28b@sigma-star.at \
    --to=david.oberhollenzer@sigma-star.at \
    --cc=chengzhihao1@huawei.com \
    --cc=dcb314@hotmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    /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®