Date: Thu, 18 Jan 2024 22:26:32 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: 319092aaacc6 - stable/13 - kldxref: Appease a Coverity warning Message-ID: <202401182226.40IMQWVC090656@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=319092aaacc6cd642ffec049565bc5c7a4f3f3f3 commit 319092aaacc6cd642ffec049565bc5c7a4f3f3f3 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:39 +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.40IMQWVC090656>