From: Maciej Żenczykowski <m...@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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to