From owner-svn-src-all@FreeBSD.ORG Thu Oct 22 12:47:04 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0844E106566C; Thu, 22 Oct 2009 12:47:04 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id CE6EF8FC1B; Thu, 22 Oct 2009 12:47:03 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 6851546B53; Thu, 22 Oct 2009 08:47:03 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 6D7448A01D; Thu, 22 Oct 2009 08:47:02 -0400 (EDT) From: John Baldwin To: Christian Brueffer Date: Thu, 22 Oct 2009 07:55:28 -0400 User-Agent: KMail/1.9.7 References: <200910220651.n9M6pTR9021597@svn.freebsd.org> In-Reply-To: <200910220651.n9M6pTR9021597@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910220755.28806.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 22 Oct 2009 08:47:02 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198358 - head/sys/dev/ppbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Oct 2009 12:47:04 -0000 On Thursday 22 October 2009 2:51:29 am Christian Brueffer wrote: > Author: brueffer > Date: Thu Oct 22 06:51:29 2009 > New Revision: 198358 > URL: http://svn.freebsd.org/changeset/base/198358 > > Log: > Check pointer for NULL before dereferencing it, not after. > > PR: 138387, 138388 > Submitted by: Patroklos Argyroudis > MFC after: 1 week In this case the '!sc' check should just be removed. It will never be true. I think this is also probably true of many of the other cases you are running into. > Modified: > head/sys/dev/ppbus/lpt.c > head/sys/dev/ppbus/pcfclock.c > > Modified: head/sys/dev/ppbus/lpt.c > ============================================================================== > --- head/sys/dev/ppbus/lpt.c Thu Oct 22 06:17:04 2009 (r198357) > +++ head/sys/dev/ppbus/lpt.c Thu Oct 22 06:51:29 2009 (r198358) > @@ -486,12 +486,15 @@ lptopen(struct cdev *dev, int flags, int > { > int trys, err; > struct lpt_data *sc = dev->si_drv1; > - device_t lptdev = sc->sc_dev; > - device_t ppbus = device_get_parent(lptdev); > + device_t lptdev; > + device_t ppbus; > > if (!sc) > return (ENXIO); > > + lptdev = sc->sc_dev; > + ppbus = device_get_parent(lptdev); > + > ppb_lock(ppbus); > if (sc->sc_state) { > lprintf(("%s: still open %x\n", device_get_nameunit(lptdev), > > Modified: head/sys/dev/ppbus/pcfclock.c > ============================================================================== > --- head/sys/dev/ppbus/pcfclock.c Thu Oct 22 06:17:04 2009 (r198357) > +++ head/sys/dev/ppbus/pcfclock.c Thu Oct 22 06:51:29 2009 (r198358) > @@ -150,12 +150,14 @@ static int > pcfclock_open(struct cdev *dev, int flag, int fms, struct thread *td) > { > struct pcfclock_data *sc = dev->si_drv1; > - device_t pcfclockdev = sc->dev; > - device_t ppbus = device_get_parent(pcfclockdev); > + device_t pcfclockdev; > + device_t ppbus; > int res; > > if (!sc) > return (ENXIO); > + pcfclockdev = sc->dev; > + ppbus = device_get_parent(pcfclockdev); > > ppb_lock(ppbus); > res = ppb_request_bus(ppbus, pcfclockdev, > -- John Baldwin