HomeFreeBSD

Silence clang static analyzer warnings about stored stack addresses

Description

Silence clang static analyzer warnings about stored stack addresses

Clang's static analyzer complains that nvs_xdr() and nvs_native()
functions return pointers to stack memory. That is technically true, but
the pointers are stored in stack memory from the caller's stack frame,
are not read by the caller and are deallocated when the caller returns,
so this is harmless. We set the pointers to NULL to silence the
warnings.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14612

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Mar 11 2023, 6:17 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Mar 14 2023, 10:25 PM
Parents
rG3cb293a6f803: Fix possible NULL pointer dereference in dbuf_verify()
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG47b994049fd1: Silence clang static analyzer warnings about stored stack addresses (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Mar 14 2023, 10:25 PM