From owner-svn-src-stable-10@FreeBSD.ORG Mon Jun 22 05:31:30 2015 Return-Path: Delivered-To: svn-src-stable-10@nevdull.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1F4A3E54; Mon, 22 Jun 2015 05:31:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D01B875; Mon, 22 Jun 2015 05:31:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5M5VTGK032259; Mon, 22 Jun 2015 05:31:29 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5M5VT1f032257; Mon, 22 Jun 2015 05:31:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201506220531.t5M5VT1f032257@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 22 Jun 2015 05:31:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284692 - stable/10/usr.bin/sockstat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2015 05:31:30 -0000 Author: tuexen Date: Mon Jun 22 05:31:29 2015 New Revision: 284692 URL: https://svnweb.freebsd.org/changeset/base/284692 Log: MFC r284547: Fix a bug reported by coverity. Since AF_UNIX sockets don't have multiple addresses, the problem didn't show up during testing. Reported by: Coverity CID: 1306787 Modified: stable/10/usr.bin/sockstat/sockstat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/sockstat/sockstat.c ============================================================================== --- stable/10/usr.bin/sockstat/sockstat.c Mon Jun 22 04:25:41 2015 (r284691) +++ stable/10/usr.bin/sockstat/sockstat.c Mon Jun 22 05:31:29 2015 (r284692) @@ -865,6 +865,7 @@ displaysock(struct sock *s, int pos) void *p; int hash; struct addr *laddr, *faddr; + struct sock *s_tmp; while (pos < 29) pos += xprintf(" "); @@ -908,18 +909,20 @@ displaysock(struct sock *s, int pos) } pos += xprintf("-> "); for (hash = 0; hash < HASHSIZE; ++hash) { - for (s = sockhash[hash]; s != NULL; s = s->next) - if (s->pcb == p) + for (s_tmp = sockhash[hash]; + s_tmp != NULL; + s_tmp = s_tmp->next) + if (s_tmp->pcb == p) break; - if (s != NULL) + if (s_tmp != NULL) break; } - if (s == NULL || - s->laddr == NULL || - s->laddr->address.ss_len == 0) + if (s_tmp == NULL || + s_tmp->laddr == NULL || + s_tmp->laddr->address.ss_len == 0) pos += xprintf("??"); else - pos += printaddr(&s->laddr->address); + pos += printaddr(&s_tmp->laddr->address); break; default: abort();