From nobody Thu Jan 18 22:26:29 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TGHQs4TRKz578TQ; Thu, 18 Jan 2024 22:26:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TGHQs3PY8z429j; Thu, 18 Jan 2024 22:26:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705616789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bnHV0539wJkkWy7lCtktjbcMhGr1EcDtYmN4Ozm51pg=; b=f9l0o9hZMgK2VcxlpQwlquBfPQWuWt2K9T9krZEPhd5E9R8bW3iOnxU1IWFh7LVgdu0dfh TZn5mykQGtIG0j/BJONs+gN9zaRH7yCkFcE2QV1+z31SyQTDzWd+afVMt3O0fzOpd40IqP j6UzJmvqTQ58ZnsbvXpFjYhNCtO8vsdZTp8/f9U4sarFWJ+5Ca1d7vpLeby3DRWx7htM2V dFYtyuWkWyyjIlg9lwwWnuZkkcww7bSltk+9ZdkPTtrfl1ZO3JVXeZKwklABasKrrfwI7T opcuqFpwAOLbWBCU5CCdIIS5rEySYamGcLJN0Sdv8dsKDxILOSrgAR5uxL/fOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705616789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bnHV0539wJkkWy7lCtktjbcMhGr1EcDtYmN4Ozm51pg=; b=WrLaQgosZk2W71yJB3ICxf35A1Rpp4nbvRGtDVhgwfW7s7QG1sfpkTZ7EQw3EhvQ5GDpxD 9/spkP8eBIkZfZntxcVgfigeskS/dfUewLiDe943sdDk5v2ebaOd9qmY3vz/qDnF1zQam9 UrJmDsQ21hqaPQSa1v25P2OihQbFUK43ehMc4SdKUCBX1a+3WUn0b8tu/K0cMGA+WwPYC4 EXCmBGBjrJ83hDQ9a+7slg9Od11dUxc5ziwNX8PLVdp8b/0VG6MAzMCYE7W/eTOPCI/bG8 wJ0dgY05TjoV1Sc9uLm4ARwN35nvWd2wAyYkay+KQRqP84Ha+4mS3aWFoKM08Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705616789; a=rsa-sha256; cv=none; b=F6hMl/Gffzm9AoK0mrH4v49Jn80BOlzLyrqGlh8rfQixOuJ8E1tQRoRjrcXPDB94zzgYBi NaI95PVyyMpBekxYb2l4m4N48DZRXsJwEjHtgmoEHgKLOaxeUm4PHBB7ur60BdKqVg6sKU LexLSdL05MMmLl2h5Ie8T5kBIhWMkl3pr8AmwP+iAaehzA3EcIYVDijViU/gEqHU6BjTxQ VfzEYBF0DZJQDBKGzHIKX9+dq9Y27Eugfi02I+7et3RbTe7KWamftVePpQRNFMzP0bUwAC PxmjvVRtN+UMoAbRPucJ77ILWOjhxM9FcK85Oosgj5wfBbtVR0QVu0QfUk236g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TGHQs2WVSzQ4c; Thu, 18 Jan 2024 22:26:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40IMQT5n090518; Thu, 18 Jan 2024 22:26:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40IMQTJI090515; Thu, 18 Jan 2024 22:26:29 GMT (envelope-from git) Date: Thu, 18 Jan 2024 22:26:29 GMT Message-Id: <202401182226.40IMQTJI090515@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: f7e181afba92 - stable/13 - kldxref: Tidy error handling for invalid addresses List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f7e181afba922aa39fc83426a51124346f2586c2 Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f7e181afba922aa39fc83426a51124346f2586c2 commit f7e181afba922aa39fc83426a51124346f2586c2 Author: John Baldwin AuthorDate: 2023-12-22 15:48:47 +0000 Commit: John Baldwin 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);