From: Daniel Borkmann <daniel@iogearbox.net>
To: Phil Sutter <phil@nwl.cc>, Stephen Hemminger <shemming@brocade.com>
Cc: netdev@vger.kernel.org
Subject: Re: [iproute PATCH 1/3] Use C99 style initializers everywhere
Date: Fri, 17 Jun 2016 18:09:20 +0200 [thread overview]
Message-ID: <576420B0.3050203@iogearbox.net> (raw)
In-Reply-To: <1466178968-27439-2-git-send-email-phil@nwl.cc>
On 06/17/2016 05:56 PM, Phil Sutter wrote:
> This big patch was compiled by vimgrepping for memset calls and changing
> to C99 initializer if applicable.
>
> Calls to memset for struct rtattr pointer fields for parse_rtattr*()
> were just dropped since they are not needed.
>
> The changes here allowed the compiler to discover some unused variables,
> so get rid of them, too.
>
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
> bridge/fdb.c | 29 +++++++------
> bridge/link.c | 16 +++----
> bridge/mdb.c | 19 ++++-----
> bridge/vlan.c | 19 ++++-----
> genl/ctrl.c | 48 +++++++++------------
> ip/ip6tunnel.c | 10 ++---
> ip/ipaddress.c | 31 ++++++--------
> ip/ipaddrlabel.c | 23 +++++-----
> ip/iplink.c | 67 ++++++++++++++---------------
> ip/iplink_can.c | 4 +-
> ip/ipmaddr.c | 27 +++++-------
> ip/ipmroute.c | 8 +---
> ip/ipneigh.c | 36 ++++++++--------
> ip/ipnetconf.c | 12 +++---
> ip/ipnetns.c | 45 ++++++++++---------
> ip/ipntable.c | 27 +++++-------
> ip/iproute.c | 85 ++++++++++++++++--------------------
> ip/iprule.c | 26 +++++------
> ip/iptoken.c | 21 ++++-----
> ip/iptunnel.c | 31 ++++----------
> ip/ipxfrm.c | 26 +++--------
> ip/link_gre.c | 22 +++++-----
> ip/link_gre6.c | 22 +++++-----
> ip/link_ip6tnl.c | 29 ++++++-------
> ip/link_iptnl.c | 26 +++++------
> ip/link_vti.c | 22 +++++-----
> ip/link_vti6.c | 22 +++++-----
> ip/xfrm_policy.c | 110 ++++++++++++++++++++++-------------------------
> ip/xfrm_state.c | 128 +++++++++++++++++++++++++++----------------------------
> lib/libnetlink.c | 74 ++++++++++++++------------------
> lib/ll_map.c | 1 -
> misc/arpd.c | 68 ++++++++++++++---------------
> misc/ss.c | 41 ++++++++----------
> tc/e_bpf.c | 7 +--
> tc/em_cmp.c | 4 +-
> tc/em_ipset.c | 4 +-
> tc/em_meta.c | 4 +-
> tc/em_nbyte.c | 4 +-
> tc/em_u32.c | 4 +-
> tc/f_flow.c | 3 --
> tc/f_flower.c | 3 +-
> tc/f_fw.c | 6 +--
> tc/f_route.c | 3 --
> tc/f_rsvp.c | 6 +--
> tc/f_u32.c | 12 ++----
> tc/m_action.c | 51 +++++++++-------------
> tc/m_bpf.c | 5 +--
> tc/m_csum.c | 4 +-
> tc/m_ematch.c | 4 +-
> tc/m_gact.c | 5 +--
> tc/m_ife.c | 5 +--
> tc/m_mirred.c | 7 +--
> tc/m_nat.c | 4 +-
> tc/m_pedit.c | 8 +---
> tc/m_police.c | 5 +--
> tc/q_atm.c | 3 +-
> tc/q_cbq.c | 22 +++-------
> tc/q_choke.c | 4 +-
> tc/q_codel.c | 3 +-
> tc/q_dsmark.c | 1 -
> tc/q_fifo.c | 4 +-
> tc/q_fq_codel.c | 3 +-
> tc/q_hfsc.c | 13 ++----
> tc/q_htb.c | 15 +++----
> tc/q_netem.c | 16 +++----
> tc/q_red.c | 4 +-
> tc/q_sfb.c | 17 ++++----
> tc/q_sfq.c | 4 +-
> tc/q_tbf.c | 4 +-
> tc/tc_bpf.c | 96 +++++++++++++++++------------------------
> tc/tc_class.c | 33 ++++++--------
> tc/tc_exec.c | 3 +-
> tc/tc_filter.c | 35 ++++++---------
> tc/tc_qdisc.c | 35 ++++++---------
> tc/tc_stab.c | 4 +-
> tc/tc_util.c | 3 +-
> 76 files changed, 699 insertions(+), 956 deletions(-)
[...]
Hmm, seems like a lot of stuff ...
[...]
> diff --git a/tc/tc_bpf.c b/tc/tc_bpf.c
> index 86c6069b68ec4..8a264531dcdd4 100644
> --- a/tc/tc_bpf.c
> +++ b/tc/tc_bpf.c
> @@ -86,13 +86,12 @@ static int bpf(int cmd, union bpf_attr *attr, unsigned int size)
> static int bpf_map_update(int fd, const void *key, const void *value,
> uint64_t flags)
> {
> - union bpf_attr attr;
> -
> - memset(&attr, 0, sizeof(attr));
> - attr.map_fd = fd;
> - attr.key = bpf_ptr_to_u64(key);
> - attr.value = bpf_ptr_to_u64(value);
> - attr.flags = flags;
> + union bpf_attr attr = {
> + .map_fd = fd,
> + .key = bpf_ptr_to_u64(key),
> + .value = bpf_ptr_to_u64(value),
> + .flags = flags
> + };
>
> return bpf(BPF_MAP_UPDATE_ELEM, &attr, sizeof(attr));
[...]
Please have a look at commit 8f80d450c3cb ("tc: fix compilation with old gcc (< 4.6)") ...
Your changes effectively revert them again. Here, and some other parts of the bpf frontend
code bits.
Thanks,
Daniel
next prev parent reply other threads:[~2016-06-17 16:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-17 15:56 [iproute PATCH 0/3] Big C99 style initializer rework Phil Sutter
2016-06-17 15:56 ` [iproute PATCH 1/3] Use C99 style initializers everywhere Phil Sutter
2016-06-17 16:09 ` Daniel Borkmann [this message]
2016-06-18 0:02 ` Phil Sutter
2016-06-18 0:21 ` Stephen Hemminger
2016-06-20 3:39 ` David Ahern
[not found] ` <ddef688e6e3f4a1a895880de1f9f069d@HQ1WP-EXMB11.corp.brocade.com>
2016-06-17 16:34 ` Stephen Hemminger
2016-06-17 16:46 ` Daniel Borkmann
2016-06-17 16:58 ` Nicolas Dichtel
[not found] ` <9e1c05c7b4894137a80bdb3d2a361bbc@HQ1WP-EXMB11.corp.brocade.com>
2016-06-17 18:57 ` Stephen Hemminger
2016-06-17 20:15 ` David Ahern
2016-06-17 20:36 ` Daniel Borkmann
2016-06-17 20:47 ` David Ahern
2016-06-17 15:56 ` [iproute PATCH 2/3] Replace malloc && memset by calloc Phil Sutter
2016-06-17 15:56 ` [iproute PATCH 3/3] No need to initialize rtattr fields before parsing Phil Sutter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=576420B0.3050203@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
--cc=phil@nwl.cc \
--cc=shemming@brocade.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).