From nobody Thu Jan 18 22:25:58 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 4TGHQG4HJ3z578NV; Thu, 18 Jan 2024 22:25:58 +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 4TGHQG2Z4Jz411Z; Thu, 18 Jan 2024 22:25:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705616758; 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=uwjmzhcIEFj/y1Lo81OENdQuiFIGUElfxj7cXWFVTNk=; b=G3Ym7cvlH+wbKUhVjAxG1jKdYdiKfFVT8CMJFUDNsXz+ala4eUCdEp6YTnol+VNtc3hzWA oEcFChk/1c6ujo8N5hwpiBwmZSWfKZ5r5LVx/VHYDO8vGCwQNCDxNI97G74EFviXyTQhRz YKjz+QKQqRXoPwuAHNO2WXVNFWG8nZUKmBuJq176Dua1G36iPl2/C/LnDDKwdR8keMP8Co l6k/r8Ku5iUPku+Buew4DDFzfQns2h5Y1SHvN+y8170FO6G+7wQWH+ElT4AOWEHgiF0UFw 1aikf1xM4IcZd3IilbG8IXDOXQheieugNGVZUKI9bdJ9QeaF3fIbyHFqSLuaIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705616758; 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=uwjmzhcIEFj/y1Lo81OENdQuiFIGUElfxj7cXWFVTNk=; b=KQqlfmA8U598y8dUJ0dZdJ2bT/UUPPVN2llHbK+K/6dAlI6HgYLJudqcfZ0ktyC+vuLB58 hCV1wGyIx+gmLr1JaxtqHmwUC+YQYCTYXfOk+sdkpZakln0LY+fVu31jWSiBA79Hce0Xfg XBt/kRv5ursxE5xqA+/+H5nr/mVy7u+oCwr+tyDxomVWL+xR0q6ov1sQ3ojw93ZLXsLxKj ZoH2cS/mw00JAnNEnYrjb9jn/cMJscVM//RI9jI8QaokZ6vvE6hAQLFDI8wLGyuyC39QQY vWaEQDaLvMmwkmyoCFpQLKHCatQJStKb8mUZvfnkQF4I8dhCQN42Zu84Zp/NXA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705616758; a=rsa-sha256; cv=none; b=yEoXWjlUrtdIzWa4LcW0r/EDpSRX5E9ROpukp6tfI4WNfPTyySxPnYBZhjdrGO+pElk5GV vVViTlTAAlOwC8IOWGZUROWubqjp4MVpwDJIJ9AekPFryHFXfpD3puAN4jhZxM/FsMPfHk ZrF6xFr4MK5okxIXvIOqLFj5YSPuNXVSf4POEvhFhqrd0Y2SsevKdSQkawWAoZjXm/HqI8 bp6VHkt+pVBqYMWPLUGENJHhPbi2LJzP+wM616BBTFK7Io3EO1hJB7dmKvIRS0HD7DGyty skmI6zfucGRS6ixRRop4fbQBduylWtGUKVCUsMRJkZZNL3SlGizR6YyVGi3y5A== 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 4TGHQG1GkmzQG5; Thu, 18 Jan 2024 22:25:58 +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 40IMPwPS089393; Thu, 18 Jan 2024 22:25:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40IMPw7e089390; Thu, 18 Jan 2024 22:25:58 GMT (envelope-from git) Date: Thu, 18 Jan 2024 22:25:58 GMT Message-Id: <202401182225.40IMPw7e089390@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: 6de6c4211bdd - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 6de6c4211bddab4c6359244684cdc3cd74b3117e Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6de6c4211bddab4c6359244684cdc3cd74b3117e commit 6de6c4211bddab4c6359244684cdc3cd74b3117e Author: John Baldwin AuthorDate: 2023-12-22 15:48:47 +0000 Commit: John Baldwin 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);