Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Apr 2002 09:10:35 -0700 (PDT)
From:      Frank Mayhar <frank@exit.com>
To:        Coleman Kane <cokane@FreeBSD.org>
Cc:        hackers@FreeBSD.org
Subject:   Re: Minor weirdness in pci/agp_amd.c.
Message-ID:  <200204151610.g3FGAZXp020560@realtime.exit.com>
In-Reply-To: <200204151535.g3FFZgEv014359@realtime.exit.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Well, I updated my tree (4.5-stable again) and was going through agp_amd.c
to check out the changes, when another gotcha jumped out at me.  At line
113 you allocate the ag_vdir, then bzero it:

        /*
         * Allocate the page directory.
         */
        gatt->ag_vdir = malloc(AGP_PAGE_SIZE, M_AGP, M_NOWAIT);
        bzero(gatt->ag_vdir, AGP_PAGE_SIZE);

        if (!gatt->ag_vdir) {

Looks to me like if the malloc fails the bzero will trap, eh?  The bzero()
should be after the "if (!gatt->ag_vdir)" test.

An extra set of eyes can always be useful, I guess. :-)
-- 
Frank Mayhar frank@exit.com	http://www.exit.com/
Exit Consulting                 http://www.gpsclock.com/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204151610.g3FGAZXp020560>