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/>

index | next in thread | previous in thread | raw e-mail

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

--- Comment #3 from Conrad Meyer <cem@freebsd.org> ---
dumpconf() is an overloaded API.  It is called in multiple ways in geom_dump.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 => !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 inform
PVS-Studio well enough to clear the false positives.  Something like:

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

    ...

    KASSERT_IMPLIES(indent == NULL, pp != NULL, ("dumpconf API violation"));

tl;dr false positive

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

help

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