From owner-svn-src-head@freebsd.org Sat May 19 02:15:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF588EE67DF; Sat, 19 May 2018 02:15:40 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F0DE755F7; Sat, 19 May 2018 02:15:40 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FDC820A9A; Sat, 19 May 2018 02:15:40 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4J2Feu9064559; Sat, 19 May 2018 02:15:40 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4J2FeB9064558; Sat, 19 May 2018 02:15:40 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805190215.w4J2FeB9064558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Sat, 19 May 2018 02:15:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333822 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 333822 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2018 02:15:41 -0000 Author: mmacy Date: Sat May 19 02:15:40 2018 New Revision: 333822 URL: https://svnweb.freebsd.org/changeset/base/333822 Log: fix gcc8 unused variable and set but not used variable in unix sockets add copyright from lock rewrite while here Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Sat May 19 00:47:24 2018 (r333821) +++ head/sys/kern/uipc_usrreq.c Sat May 19 02:15:40 2018 (r333822) @@ -4,7 +4,7 @@ * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. * Copyright (c) 2004-2009 Robert N. M. Watson - * All rights reserved. + * Copyright (c) 2018 Matthew Macy * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -765,6 +765,7 @@ uipc_detach(struct socket *so) KASSERT(unp != NULL, ("uipc_detach: unp == NULL")); vp = NULL; + vplock = NULL; local_unp_rights = 0; UNP_LINK_WLOCK(); @@ -787,7 +788,8 @@ uipc_detach(struct socket *so) } if (unp->unp_vnode != vp && unp->unp_vnode != NULL) { - mtx_unlock(vplock); + if (vplock) + mtx_unlock(vplock); UNP_PCB_UNLOCK(unp); if (unp2) UNP_PCB_UNLOCK(unp2); @@ -1676,7 +1678,9 @@ static void unp_disconnect(struct unpcb *unp, struct unpcb *unp2) { struct socket *so, *so2; - int rele, freed; +#ifdef INVARIANTS + int freed; +#endif KASSERT(unp2 != NULL, ("unp_disconnect: unp2 == NULL")); @@ -1688,7 +1692,6 @@ unp_disconnect(struct unpcb *unp, struct unpcb *unp2) MPASS(unp->unp_conn == unp2); unp->unp_conn = NULL; - rele = 0; so = unp->unp_socket; so2 = unp2->unp_socket; switch (unp->unp_socket->so_type) { @@ -1713,9 +1716,15 @@ unp_disconnect(struct unpcb *unp, struct unpcb *unp2) soisdisconnected(so2); break; } - freed = unp_pcb_rele(unp); +#ifdef INVARIANTS + freed = +#endif + unp_pcb_rele(unp); MPASS(freed == 0); - freed = unp_pcb_rele(unp2); +#ifdef INVARIANTS + freed = +#endif + unp_pcb_rele(unp2); MPASS(freed == 0); }