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]
Message-ID: <3a3c006cc1c644fd8e2fe791dba5139a@AcuMS.aculab.com>
Date:   Sat, 17 Apr 2021 11:07:55 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Matteo Croce' <mcroce@...ux.microsoft.com>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Julia Lawall <julia.lawall@...ia.fr>
Subject: RE: [PATCH net-next v2 0/3] introduce skb_for_each_frag()

From: Matteo Croce
> Sent: 16 April 2021 23:44
...
> > A more interesting change would be something that generated:
> >         unsigned int nr_frags = skb_shinfo(skb)->nr_frags;
> >         for (i = 0; i < nr_frags; i++) {
> > since that will run faster for most loops.
> > But that is ~impossible to do since you can't declare
> > variables inside the (...) that are scoped to the loop.
> >
> 
> I don't know how to do it with C90.
> It would be nice to have a switch to just allow declaration of
> variables inside the (...) instead of enabling the full C99 language
> which, as Linus said[1], allows the insane mixing of variables and
> code.
> 
> [1] https://lore.kernel.org/lkml/CA+55aFzs=DuYibWYMUFiU_R1aJHAr-8hpQhWLew8R5q4nCDraQ@mail.gmail.com/

Quoting Linus:

> I *like* getting warnings for confused people who start introducing
> variables in the middle of blocks of code. That's not well-contained
> like the loop variable.

The really stupid part of C99 is that such variables can alias
ones in an outer block.
Aliased definitions are bad enough at the best of times.
Makes it very easy to miss the correct definition when reading code.

I much prefer local variables to either function scope or be
defined for very local use at the top of a very small block.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ