Skip to content

Commit

Permalink
cppcheck: (warning) Possible null pointer dereference: dnp
Browse files Browse the repository at this point in the history
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

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
  • Loading branch information
behlendorf committed Dec 16, 2019
1 parent 0f02a61 commit dd35210
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions module/zfs/dnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,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);
Expand Down

0 comments on commit dd35210

Please sign in to comment.