Date: Thu, 18 Jan 2024 22:26:29 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: f7e181afba92 - stable/13 - kldxref: Tidy error handling for invalid addresses Message-ID: <202401182226.40IMQTJI090515@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=f7e181afba922aa39fc83426a51124346f2586c2 commit f7e181afba922aa39fc83426a51124346f2586c2 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:14 +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?202401182226.40IMQTJI090515>