lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 16 Feb 2021 09:39:58 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     Xie He <xie.he.0141@...il.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Linux X25 <linux-x25@...r.kernel.org>,
        Linux Kernel Network Developers <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Martin Schiller <ms@....tdt.de>,
        Krzysztof Halasa <khc@...waw.pl>
Subject: Re: [PATCH net-next RFC v3] net: hdlc_x25: Queue outgoing LAPB frames

On Mon, Feb 15, 2021 at 11:30:25PM -0800, Xie He wrote:
> On Mon, Feb 15, 2021 at 10:04 PM Leon Romanovsky <leon@...nel.org> wrote:
> >
> > On Mon, Feb 15, 2021 at 11:08:02AM -0800, Xie He wrote:
> > > On Mon, Feb 15, 2021 at 10:54 AM Leon Romanovsky <leon@...nel.org> wrote:
> > > >
> > > > On Mon, Feb 15, 2021 at 09:23:32AM -0800, Xie He wrote:
> > > > > On Mon, Feb 15, 2021 at 1:25 AM Leon Romanovsky <leon@...nel.org> wrote:
> > > > > >
> > > > > > > +     /* When transmitting data:
> > > > > > > +      * first we'll remove a pseudo header of 1 byte,
> > > > > > > +      * then the LAPB module will prepend an LAPB header of at most 3 bytes.
> > > > > > > +      */
> > > > > > > +     dev->needed_headroom = 3 - 1;
> > > > > >
> > > > > > 3 - 1 = 2
> > > > > >
> > > > > > Thanks
> > > > >
> > > > > Actually this is intentional. It makes the numbers more meaningful.
> > > > >
> > > > > The compiler should automatically generate the "2" so there would be
> > > > > no runtime penalty.
> > > >
> > > > If you want it intentional, write it in the comment.
> > > >
> > > > /* When transmitting data, we will need extra 2 bytes headroom,
> > > >  * which are 3 bytes of LAPB header minus one byte of pseudo header.
> > > >  */
> > > >  dev->needed_headroom = 2;
> > >
> > > I think this is unnecessary. The current comment already explains the
> > > meaning of the "1" and the "3". There's no need for a reader of this
> > > code to understand what a "2" is. That is the job of the compiler, not
> > > the human reader.
> >
> > It is not related to compiler/human format. If you need to write "3 - 1"
> > to make it easy for users, it means that your comment above is not
> > full/correct/e.t.c.
>
> My point is: there is no need for human programmers / code readers to
> understand what this "2" is. There is no need to explain what this "2"
> means in the comment. There is no need to write this "2" in the code.
> There is no need for this "2" to appear anywhere. That is just an
> intermediate result generated by the compiler. It is similar to
> assembly or machine code. It is generated by the compiler. Human
> programmers just don't care about this intermediate result.
>
> My point could be more apparent if you consider a more complex
> situation: "3 - 1 + 2 + 4 + 2". No human would want to see a
> meaningless "10" in the code. We want to see the meaning of the
> numbers, not a meaningless intermediate calculation result.

Right, and we are using defines for that.

Thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ