From owner-svn-src-head@FreeBSD.ORG Thu Feb 26 23:30:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEF0F1065670; Thu, 26 Feb 2009 23:30:08 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27]) by mx1.freebsd.org (Postfix) with ESMTP id 83D848FC18; Thu, 26 Feb 2009 23:30:08 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from localhost (amavis.str.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id F2ED541C756; Fri, 27 Feb 2009 00:30:05 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([62.111.66.27]) by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id IiAay0TgDywa; Fri, 27 Feb 2009 00:30:05 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 9A9EB41C752; Fri, 27 Feb 2009 00:30:05 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 1AD7444495C; Thu, 26 Feb 2009 23:25:17 +0000 (UTC) Date: Thu, 26 Feb 2009 23:25:16 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Ed Schouten In-Reply-To: <200902261212.n1QCCYI6027315@svn.freebsd.org> Message-ID: <20090226232352.S53478@maildrop.int.zabbadoz.net> References: <200902261212.n1QCCYI6027315@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189066 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 26 Feb 2009 23:30:09 -0000 On Thu, 26 Feb 2009, Ed Schouten wrote: > Author: ed > Date: Thu Feb 26 12:12:34 2009 > New Revision: 189066 > URL: http://svn.freebsd.org/changeset/base/189066 > > Log: > Remove redundant assignment of `p'. > > `p' is already initialized with `td->td_proc'. Because td is always > curthread, it is safe to initialize it without any locks. > > Found by: LLVM's scan-build > > Modified: > head/sys/kern/subr_prf.c > > Modified: head/sys/kern/subr_prf.c > ============================================================================== > --- head/sys/kern/subr_prf.c Thu Feb 26 12:06:46 2009 (r189065) > +++ head/sys/kern/subr_prf.c Thu Feb 26 12:12:34 2009 (r189066) > @@ -137,7 +137,6 @@ uprintf(const char *fmt, ...) > return (0); > > sx_slock(&proctree_lock); > - p = td->td_proc; > PROC_LOCK(p); > if ((p->p_flag & P_CONTROLT) == 0) { > PROC_UNLOCK(p); I think this one is wrong. You should probably have removed the assignment from declaration time as we are checking for td != NULL just above that so it could possibly be a NULL pointer deref in the initial assigment or the NULL check is redundant. -- Bjoern A. Zeeb The greatest risk is not taking one.