fs/jffs2/readinode.c:189: faulty logic ?
David Woodhouse
dwmw2 at infradead.org
Tue Jan 24 15:30:20 PST 2017
On Tue, 2017-01-24 at 08:15 +0000, David Binderman wrote:
> Hello there,
>
> fs/jffs2/readinode.c:189]: (style) Condition 'tn.fn.ofs>=offset' is
> always true
>
> 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;
Thanks for pointing this out; it looks like a correct fix at first.
However, it might expose a bug, if the 'break' case isn't particularly
well-tested. The existing bug is probably fairly harmless, while the
hypothetical new one isn't. So we need to take a closer look at the
surrounding code and ideally test it...
--
dwmw2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4938 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20170124/2a596bcb/attachment.bin>
More information about the linux-mtd
mailing list