fs/jffs2/readinode.c:189: faulty logic ?

Richard Weinberger richard.weinberger at gmail.com
Tue Jan 24 14:20:39 PST 2017


David,

On Tue, Jan 24, 2017 at 9:15 AM, David Binderman <dcb314 at hotmail.com> wrote:
> Hello there,
>
> fs/jffs2/readinode.c:189]: (style) Condition 'tn.fn.ofs>=offset' is always true

What tool produces this info?

> Source code is
>
>         if (tn->fn->ofs < offset)
>             next = tn->rb.rb_right;
>         else if (tn->fn->ofs >= offset)
>             next = tn->rb.rb_left;
>         else
>             break;
>
> Maybe better code
>
>         if (tn->fn->ofs < offset)
>             next = tn->rb.rb_right;
>         else if (tn->fn->ofs > offset)
>             next = tn->rb.rb_left;
>         else
>             break;

That code is odd, yes. But we need more info.
Why is fn.fn.ofs>=offset always true?
AFAICT tn->fn->ofs > offset can be also true but
else break is never reached.

-- 
Thanks,
//richard



More information about the linux-mtd mailing list