Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 04 Jun 2019 00:38:22 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 238309] geom/geom_slice.c: potential NULL pointer dereference in g_slice_dumpconf()
Message-ID:  <bug-238309-227-LcFGvAhkEF@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-238309-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-238309-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D238309

--- Comment #3 from Conrad Meyer <cem@freebsd.org> ---
dumpconf() is an overloaded API.  It is called in multiple ways in geom_dum=
p.c:

1. NULL indent, NULL cp, !NULL pp
2. !NULL indent, NULL cp, !NULL pp
3. !NULL indent, NULL cp, NULL pp

I.e., NULL indent =3D> !NULL pp.  But !NULL indent implies nothing about pp=
.  The
logic in g_slice_dumpconf is correct, though confusing.

It would probably be more clear to assert these invariants, which might inf=
orm
PVS-Studio well enough to clear the false positives.  Something like:

    #define KASSERT_IMPLIES(a, b, c) KASSERT(!(a) || (b), c)

    ...

    KASSERT_IMPLIES(indent =3D=3D NULL, pp !=3D NULL, ("dumpconf API violat=
ion"));

tl;dr false positive

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-238309-227-LcFGvAhkEF>