netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Maciej Żenczykowski" <zenczykowski@gmail.com>
To: "Maciej Żenczykowski" <maze@google.com>,
	"Stephen Hemminger" <shemming@brocade.com>,
	"Eric Dumazet" <edumazet@google.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH 2/2] iproute2: misc/ss.c - fix run_ssfilter af_packet when protocol == 0
Date: Thu, 25 Jun 2015 02:03:03 -0700	[thread overview]
Message-ID: <1435222983-14661-2-git-send-email-zenczykowski@gmail.com> (raw)
In-Reply-To: <1435222983-14661-1-git-send-email-zenczykowski@gmail.com>

From: Maciej Żenczykowski <maze@google.com>

s->local.data is a pointer to a field of a non-NULL struct, and hence
cannot be NULL, thus comparing it to 0 is always false, and thus the
return is always false.

Presumably this was meant to be a check whether s->local.data[0] (which
I believe stores af_packet protocol) is 0, ie. ANY.

Change-Id: Ia232f5b06ce081e3b2fb6338f1a709cd94e03ae5
Fixes:
  ss.c:1018:37: error: comparison of array 's->local.data' equal to a null pointer is always false [-Werror,-Wtautological-pointer-compare]
    return s->lport == 0 && s->local.data == 0;
                            ~~~~~~~~~^~~~    ~
  1 error generated.
---
 misc/ss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/ss.c b/misc/ss.c
index dba0901791c7..36b0efdfd32f 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1090,7 +1090,7 @@ static int run_ssfilter(struct ssfilter *f, struct sockstat *s)
 					     strspn(p+1, "0123456789abcdef") == 5);
 		}
 		if (s->local.family == AF_PACKET)
-			return s->lport == 0 && s->local.data == 0;
+			return s->lport == 0 && s->local.data[0] == 0;
 		if (s->local.family == AF_NETLINK)
 			return s->lport < 0;
 
-- 
2.4.3.573.g4eafbef

  reply	other threads:[~2015-06-25  9:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25  9:03 [PATCH 1/2] iproute2: tc/m_pedit.c - remove dead code Maciej Żenczykowski
2015-06-25  9:03 ` Maciej Żenczykowski [this message]
2015-06-25 12:54 ` Stephen Hemminger

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=1435222983-14661-2-git-send-email-zenczykowski@gmail.com \
    --to=zenczykowski@gmail.com \
    --cc=edumazet@google.com \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    --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).