linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* linux-6.16/fs/jffs2/readinode.c:189: loop can never finish
@ 2025-08-04  6:23 David Binderman
  2025-08-04  7:10 ` Zhihao Cheng
  0 siblings, 1 reply; 4+ messages in thread
From: David Binderman @ 2025-08-04  6:23 UTC (permalink / raw)
  To: dwmw2@infradead.org, richard@nod.at,
	linux-mtd@lists.infradead.org, Linux Kernel Mailing List

Hello there,

Static analyser cppcheck said:

linux-6.16/fs/jffs2/readinode.c:189:24: style: Expression is always true because 'else if' condition is opposite to previous condition at line 187. [multiCondition]

Source code is

    while (next) {
        tn = rb_entry(next, struct jffs2_tmp_dnode_info, rb);

        if (tn->fn->ofs < offset)
            next = tn->rb.rb_right;
        else if (tn->fn->ofs >= offset)
            next = tn->rb.rb_left;
        else
            break;
    }

It looks to me like this loop will never finish. 
Suggest change ">=" to ">".

Regards

David Binderman


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-04 11:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-04  6:23 linux-6.16/fs/jffs2/readinode.c:189: loop can never finish David Binderman
2025-08-04  7:10 ` Zhihao Cheng
2025-08-04  7:30   ` David Oberhollenzer
2025-08-04 10:54     ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).