From mboxrd@z Thu Jan 1 00:00:00 1970 From: "=?UTF-8?q?Maciej=20=C5=BBenczykowski?=" Subject: [PATCH 10/11] net: rtm_to_fib6_config() - use new style struct initializer instead of memset Date: Thu, 27 Sep 2018 16:00:16 -0700 Message-ID: <20180927230017.15398-10-zenczykowski@gmail.com> References: <20180927230017.15398-1-zenczykowski@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Cc: netdev@vger.kernel.org To: "=?UTF-8?q?Maciej=20=C5=BBenczykowski?=" , "David S . Miller" Return-path: Received: from mail-io1-f74.google.com ([209.85.166.74]:44824 "EHLO mail-io1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725972AbeI1FV0 (ORCPT ); Fri, 28 Sep 2018 01:21:26 -0400 Received: by mail-io1-f74.google.com with SMTP id s15-v6so4480275iob.11 for ; Thu, 27 Sep 2018 16:00:47 -0700 (PDT) In-Reply-To: <20180927230017.15398-1-zenczykowski@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Maciej Żenczykowski (allows for better compiler optimization) Signed-off-by: Maciej Żenczykowski --- net/ipv6/route.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index b8fece1d6021..9aca81772c93 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -4139,14 +4139,19 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh, err = -EINVAL; rtm = nlmsg_data(nlh); - memset(cfg, 0, sizeof(*cfg)); - cfg->fc_table = rtm->rtm_table; - cfg->fc_dst_len = rtm->rtm_dst_len; - cfg->fc_src_len = rtm->rtm_src_len; - cfg->fc_flags = RTF_UP; - cfg->fc_protocol = rtm->rtm_protocol; - cfg->fc_type = rtm->rtm_type; + *cfg = (struct fib6_config){ + .fc_table = rtm->rtm_table, + .fc_dst_len = rtm->rtm_dst_len, + .fc_src_len = rtm->rtm_src_len, + .fc_flags = RTF_UP, + .fc_protocol = rtm->rtm_protocol, + .fc_type = rtm->rtm_type, + + .fc_nlinfo.portid = NETLINK_CB(skb).portid, + .fc_nlinfo.nlh = nlh, + .fc_nlinfo.nl_net = sock_net(skb->sk), + }; if (rtm->rtm_type == RTN_UNREACHABLE || rtm->rtm_type == RTN_BLACKHOLE || @@ -4162,10 +4167,6 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh, cfg->fc_flags |= (rtm->rtm_flags & RTNH_F_ONLINK); - cfg->fc_nlinfo.portid = NETLINK_CB(skb).portid; - cfg->fc_nlinfo.nlh = nlh; - cfg->fc_nlinfo.nl_net = sock_net(skb->sk); - if (tb[RTA_GATEWAY]) { cfg->fc_gateway = nla_get_in6_addr(tb[RTA_GATEWAY]); cfg->fc_flags |= RTF_GATEWAY; -- 2.19.0.605.g01d371f741-goog