[Bug 203499] KASSERT for non-NULL in g_uzip.c after value is dereferenced

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Oct 2 03:20:33 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203499

            Bug ID: 203499
           Summary: KASSERT for non-NULL in g_uzip.c after value is
                    dereferenced
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: chadf at triularity.org

Created attachment 161639
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=161639&action=edit
Patch to correct error

g_uzip_destroy_geom() in g_uzip.c deferences the variable 'gp' before the
KASSERT(gp != NULL) is called. The assertion should be moved up.

        if (gp->softc == NULL) {
                DPRINTF(("%s(%s): gp->softc == NULL\n", __func__, gp->name));
                return (ENXIO);
        }

        KASSERT(gp != NULL, ("NULL geom"));

-->>

        KASSERT(gp != NULL, ("NULL geom"));
        if (gp->softc == NULL) {
                DPRINTF(("%s(%s): gp->softc == NULL\n", __func__, gp->name));
                return (ENXIO);
        }

Patch included.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list