Date: Thu, 18 Jan 2024 22:25:58 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: 6de6c4211bdd - stable/14 - kldxref: Tidy error handling for invalid addresses Message-ID: <202401182225.40IMPw7e089390@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=6de6c4211bddab4c6359244684cdc3cd74b3117e commit 6de6c4211bddab4c6359244684cdc3cd74b3117e Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2023-12-22 15:48:47 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-01-18 21:31:06 +0000 kldxref: Tidy error handling for invalid addresses - Don't print an offset value that's always zero. - ef_get_offset can't return -1. Reviewed by: imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D43124 (cherry picked from commit 6d46e2e0a7f345459fb42e666c7cb2e987c70857) --- usr.sbin/kldxref/ef.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/kldxref/ef.c b/usr.sbin/kldxref/ef.c index aa9123d7f540..46d3dc1f4578 100644 --- a/usr.sbin/kldxref/ef.c +++ b/usr.sbin/kldxref/ef.c @@ -512,8 +512,8 @@ ef_seg_read_rel(elf_file_t ef, GElf_Addr address, size_t len, void *dest) ofs = ef_get_offset(ef, address); if (ofs == 0) { if (ef->ef_verbose) - warnx("ef_seg_read_rel(%s): zero offset (%jx:%ju)", - ef->ef_name, (uintmax_t)address, (uintmax_t)ofs); + warnx("ef_seg_read_rel(%s): bad address (%jx)", + ef->ef_name, (uintmax_t)address); return (EFAULT); } error = elf_read_raw_data(ef->ef_efile, ofs, dest, len); @@ -542,7 +542,7 @@ ef_seg_read_string(elf_file_t ef, GElf_Addr address, size_t len, char *dest) int error; ofs = ef_get_offset(ef, address); - if (ofs == 0 || ofs == (GElf_Off)-1) { + if (ofs == 0) { if (ef->ef_verbose) warnx("ef_seg_read_string(%s): bad offset (%jx:%ju)", ef->ef_name, (uintmax_t)address, (uintmax_t)ofs);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401182225.40IMPw7e089390>