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

From: Richard Weinberger
Date: Tue Jan 24 2017 - 17:20:45 EST


David,

On Tue, Jan 24, 2017 at 9:15 AM, David Binderman <dcb314@xxxxxxxxxxx> 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