Date: Thu, 18 Jan 2024 22:26:01 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 8ac6f5e39417 - stable/14 - kldxref: Appease a Coverity warning Message-ID: <202401182226.40IMQ16L089526@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8ac6f5e3941796195ae1e78602523499a20b68b7 commit 8ac6f5e3941796195ae1e78602523499a20b68b7 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2023-12-22 15:49:40 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-01-18 21:31:43 +0000 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 (cherry picked from commit d281fece432f97b4424b852f23dfe1f974b9e30d) --- usr.sbin/kldxref/ef.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/kldxref/ef.c b/usr.sbin/kldxref/ef.c index 46d3dc1f4578..fd0782ff1dd0 100644 --- a/usr.sbin/kldxref/ef.c +++ b/usr.sbin/kldxref/ef.c @@ -361,6 +361,7 @@ ef_parse_dynamic(elf_file_t ef, const GElf_Phdr *phdyn) goto out; } + nsym = 0; for (i = 0; i < nshdr; i++) { switch (shdr[i].sh_type) { case SHT_HASH:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401182226.40IMQ16L089526>