lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <df923d94-92ee-f824-01e2-21e6ed3d593c@huawei.com>
Date: Mon, 4 Aug 2025 15:10:35 +0800
From: Zhihao Cheng <chengzhihao1@...wei.com>
To: David Binderman <dcb314@...mail.com>, "dwmw2@...radead.org"
	<dwmw2@...radead.org>, "richard@....at" <richard@....at>,
	"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>, Linux Kernel
 Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: linux-6.16/fs/jffs2/readinode.c:189: loop can never finish

在 2025/8/4 14:23, David Binderman 写道:
> 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) {

Hi,
The 'next != NULL' is also a condition for the loop, this snippet of 
code finds a leaf node in 'tn_root'.
>          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/
> .
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ