netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org
Subject: [iproute PATCH v2 5/7] ss: Use C99 initializer in netlink_show_one()
Date: Thu, 17 Aug 2017 19:09:29 +0200	[thread overview]
Message-ID: <20170817170931.24302-6-phil@nwl.cc> (raw)
In-Reply-To: <20170817170931.24302-1-phil@nwl.cc>

This has the additional benefit of initializing st.ino to zero which is
used later in is_sctp_assoc() function.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 misc/ss.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/misc/ss.c b/misc/ss.c
index b2a7f069e294c..d767b1103ea81 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -3469,17 +3469,18 @@ static int netlink_show_one(struct filter *f,
 				int rq, int wq,
 				unsigned long long sk, unsigned long long cb)
 {
-	struct sockstat st;
+	struct sockstat st = {
+		.state		= SS_CLOSE,
+		.rq		= rq,
+		.wq		= wq,
+		.local.family	= AF_NETLINK,
+		.remote.family	= AF_NETLINK,
+	};
 
 	SPRINT_BUF(prot_buf) = {};
 	const char *prot_name;
 	char procname[64] = {};
 
-	st.state = SS_CLOSE;
-	st.rq	 = rq;
-	st.wq	 = wq;
-	st.local.family = st.remote.family = AF_NETLINK;
-
 	if (f->f) {
 		st.rport = -1;
 		st.lport = pid;
-- 
2.13.1

  parent reply	other threads:[~2017-08-17 17:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-17 17:09 [iproute PATCH v2 0/7] Covscan: Don't access garbage Phil Sutter
2017-08-17 17:09 ` [iproute PATCH v2 1/7] ipaddress: Make buffer for filter.flushb static Phil Sutter
2017-08-18 11:57   ` Phil Sutter
2017-08-18 15:55     ` Stephen Hemminger
2017-08-17 17:09 ` [iproute PATCH v2 2/7] ipaddress: Avoid accessing uninitialized variable lcl Phil Sutter
2017-08-17 17:09 ` [iproute PATCH v2 3/7] iplink_can: Prevent overstepping array bounds Phil Sutter
2017-08-17 17:09 ` [iproute PATCH v2 4/7] ipmaddr: Avoid accessing uninitialized data Phil Sutter
2017-08-17 17:09 ` Phil Sutter [this message]
2017-08-17 17:09 ` [iproute PATCH v2 6/7] netem/maketable: Check return value of fstat() Phil Sutter
2017-08-17 17:09 ` [iproute PATCH v2 7/7] tc/q_multiq: Don't pass garbage in TCA_OPTIONS 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=20170817170931.24302-6-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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).