HomeFreeBSD

kldxref: Appease a Coverity warning

Description

kldxref: Appease a Coverity warning

While parsing .dynamic, nsym is set when parsing the symbol table from
.dynsym. That parsing also sets ef->ef_symtab to a non-NULL value.
The value of nsym isn't validated until after a check for
ef->ef_symtab being NULL, so nsym always has a valid value when it is
read. However, that chain of events is a bit much for static analysis
to follow, so initialize nsym to 0 before parsing sections to quiet
the warning.

Reported by: Coverity Scan
CID: 1532339
Sponsored by: DARPA

Details

Provenance
jhbAuthored on Dec 22 2023, 3:49 PM
Parents
rG0d557cdf6f0e: kldxref: Simplify handling of ELF object files
Branches
Unknown
Tags
Unknown