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] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 17 Apr 2021 00:44:06 +0200
From:   Matteo Croce <mcroce@...ux.microsoft.com>
To:     David Laight <David.Laight@...lab.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()

On Tue, Apr 13, 2021 at 9:53 AM David Laight <David.Laight@...lab.com> wrote:
>
> From: Matteo Croce
> > Sent: 12 April 2021 01:38
> >
> > Introduce skb_for_each_frag, an helper macro to iterate over the SKB frags.
>
> The real question is why, the change is:
>
> -       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
> +       skb_for_each_frag(skb, i) {
>
> The existing code isn't complicated or obscure and 'does what it
> says on the tin'.
> The 'helper' requires you go and look up its definition to see
> what it is really doing.
>
> Unless you have a cunning plan to change the definition
> there is zero point.
>
> 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/
-- 
per aspera ad upstream

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ