From 4865a0fb18a1491d6e45c424cf434f8c38769785 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 16 Dec 2019 10:55:11 -0800 Subject: [PATCH] cppcheck: (warning) Possible null pointer dereference: dnp The dnp argument can only be set to NULL when the DNODE_DRY_RUN flag is set. In which case, an early return path will be executed and a NULL pointer dereference at the given location is impossible. Add an additional ASSERT to silence the cppcheck warning and document that dbp must never be NULL at the point in the function. [module/zfs/dnode.c:1566]: (warning) Possible null pointer deref: dnp Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #9732 --- module/zfs/dnode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index ec297a242b2e..7acfc36c87d0 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -1561,6 +1561,7 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots, dnode_slots_rele(dnc, idx, slots); DNODE_VERIFY(dn); + ASSERT3P(dnp, !=, NULL); ASSERT3P(dn->dn_dbuf, ==, db); ASSERT3U(dn->dn_object, ==, object); dbuf_rele(db, FTAG);