Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1565917

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

From Marek Vasut <marek.vasut@gmail.com>
Newsgroups linux.kernel
Subject Re: fs/jffs2/readinode.c:189: faulty logic ?
Date 2017-01-24 16:00 +0100
Message-ID <t3aJI-5zH-19@gated-at.bofh.it> (permalink)
References <t3aJI-5zH-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01/24/2017 09:15 AM, 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;

This changes the logic of the code for equality case, please elaborate
why this is OK.

> Regards
> 
> David Binderman
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
> 


-- 
Best regards,
Marek Vasut

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: fs/jffs2/readinode.c:189: faulty logic ? Marek Vasut <marek.vasut@gmail.com> - 2017-01-24 16:00 +0100
  Re: fs/jffs2/readinode.c:189: faulty logic ? Marek Vasut <marek.vasut@gmail.com> - 2017-01-24 16:20 +0100
  Re: fs/jffs2/readinode.c:189: faulty logic ? Marek Vasut <marek.vasut@gmail.com> - 2017-01-24 21:10 +0100

csiph-web