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:   Thu, 11 Aug 2022 14:35:47 +0200
From:   Alexander Lobakin <alexandr.lobakin@...el.com>
To:     "shenjian (K)" <shenjian15@...wei.com>
Cc:     Alexander Lobakin <alexandr.lobakin@...el.com>,
        davem@...emloft.net, kuba@...nel.org, andrew@...n.ch,
        ecree.xilinx@...il.com, hkallweit1@...il.com, saeed@...nel.org,
        leon@...nel.org, netdev@...r.kernel.org, linuxarm@...neuler.org
Subject: Re: [RFCv7 PATCH net-next 16/36] treewide: use replace features '0' by netdev_empty_features

From: "shenjian (K)" <shenjian15@...wei.com>
Date: Wed, 10 Aug 2022 20:25:38 +0800

> 在 2022/8/10 18:48, Alexander Lobakin 写道:
> > From: Jian Shen <shenjian15@...wei.com>
> > Date: Wed, 10 Aug 2022 11:06:04 +0800
> >
> >> For the prototype of netdev_features_t will be changed from
> >> u64 to bitmap, so it's unable to assignment with 0 directly.
> >> Replace it with netdev_empty_features.
> > Hmm, why not just netdev_features_zero() instead?
> > There's a couple places where empty netdev_features are needed, but
> > they're not probably worth a separate and rather pointless empty
> > variable, you could create one on the stack there.
> As replied before, the new netdev_features_t supports being
> assigned directly, so use netdev_emtpy_features looks
> more simple.

Dunno, looks reduntant. For declaring onstack variables, one can
simply:

	netdev_features_t feat = { };

For zeroing in the code it's a bit more complex:

	feat = (typeof(feat)){ };

But I can't remember empty complex variables in the kernel code
declared just to ease type initialization.

Hmm, how about

#define netdev_empty_features	((netdev_features_t){ })

?

It would work just as your variable, but without creating any
globals.
Before converting netdev_features to a structure, you can define
it just as `0`.

> 
> >> Signed-off-by: Jian Shen <shenjian15@...wei.com>
> >> ---
> >>   drivers/hsi/clients/ssi_protocol.c             | 2 +-
> >>   drivers/net/caif/caif_serial.c                 | 2 +-
> >>   drivers/net/ethernet/amazon/ena/ena_netdev.c   | 2 +-
> >>   drivers/net/ethernet/broadcom/b44.c            | 2 +-
> >>   drivers/net/ethernet/broadcom/tg3.c            | 2 +-
> >>   drivers/net/ethernet/dnet.c                    | 2 +-
> >>   drivers/net/ethernet/ec_bhf.c                  | 2 +-
> >>   drivers/net/ethernet/emulex/benet/be_main.c    | 2 +-
> >>   drivers/net/ethernet/ethoc.c                   | 2 +-
> >>   drivers/net/ethernet/huawei/hinic/hinic_main.c | 5 +++--
> >>   drivers/net/ethernet/ibm/ibmvnic.c             | 6 +++---
> >>   drivers/net/ethernet/intel/iavf/iavf_main.c    | 9 +++++----
> >>   drivers/net/ethernet/microsoft/mana/mana_en.c  | 2 +-
> >>   drivers/net/ethernet/sfc/ef10.c                | 2 +-
> >>   drivers/net/tap.c                              | 2 +-
> >>   drivers/net/tun.c                              | 2 +-
> >>   drivers/net/usb/cdc-phonet.c                   | 3 ++-
> >>   drivers/net/usb/lan78xx.c                      | 2 +-
> >>   drivers/s390/net/qeth_core_main.c              | 2 +-
> >>   drivers/usb/gadget/function/f_phonet.c         | 3 ++-
> >>   net/dccp/ipv4.c                                | 2 +-
> >>   net/dccp/ipv6.c                                | 2 +-
> >>   net/ethtool/features.c                         | 2 +-
> >>   net/ethtool/ioctl.c                            | 6 ++++--
> >>   net/ipv4/af_inet.c                             | 2 +-
> >>   net/ipv4/tcp.c                                 | 2 +-
> >>   net/ipv4/tcp_ipv4.c                            | 2 +-
> >>   net/ipv6/af_inet6.c                            | 2 +-
> >>   net/ipv6/inet6_connection_sock.c               | 2 +-
> >>   net/ipv6/tcp_ipv6.c                            | 2 +-
> >>   net/openvswitch/datapath.c                     | 2 +-
> >>   31 files changed, 44 insertions(+), 38 deletions(-)
> > [...]
> >
> >> -- 
> >> 2.33.0
> > Thanks,
> > Olek
> > .
> >
> Thanks,
> Jian

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ