linux-6.16/fs/jffs2/readinode.c:189: loop can never finish

David Binderman dcb314 at hotmail.com
Sun Aug 3 23:23:36 PDT 2025


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




More information about the linux-mtd mailing list