HomeFreeBSD

cppcheck: (warning) Possible null pointer dereference: nvh

Description

cppcheck: (warning) Possible null pointer dereference: nvh

Move the 'nvh = (void *)buf' assignment after the 'buf == NULL'
check to resolve the warning. Interestingly, cppcheck 1.88
correctly determines that the existing code is safe, while
cppcheck 1.86 reports the warning.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #9732

Details

Provenance
Brian Behlendorf <behlendorf1@llnl.gov>Authored on Dec 17 2019, 12:03 AM
Parents
rG487bddad67f5: cppcheck: (error) Address of local auto-variable assigned
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGd16a207f2edd: cppcheck: (warning) Possible null pointer dereference: nvh (authored by Brian Behlendorf <behlendorf1@llnl.gov>).Dec 19 2019, 1:25 AM