From nobody Fri Dec 22 15:50:10 2023 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 4SxWw24zYTz547Wj; Fri, 22 Dec 2023 15:50:10 +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 4SxWw24Q78z3RCg; Fri, 22 Dec 2023 15:50:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703260210; 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=7VQqYLYmqz+gEm2/K/Zjgxg51SYBUBSwWo2x+jHYQto=; b=k8hPEXT6+Xo97vqQhBkKJtUy58dPziStIV8UOVbS721vREP8qqNugf6c5ecMo7rIljuvd7 7XgBSy3+MIc1tx1nRLKqDdq1riKHEY7ctmrW5UxAMoP0DhcPNI46UIp7xU/VbTOsH5QxyN zNfFOInajUvuRUB7etaDy8kL2XFg8ulCJvFbzz9qRJjo3m0gGlcO+ejXs7CuIi8IIr/z4v POGTGvedReJ8bG1kQ/Uy+O6DAh2vZrijQfSOqo1dVfUZNRslxLFzdvvsIvLfMtSo1W7OCQ 0tGkKNVsAKOpc6CYVCzYl9gzMQZMLTDLwvkktNAy8pGbXFDd6QKxQEr9UFewog== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703260210; a=rsa-sha256; cv=none; b=tBJEw8+a3n2i5wFA7e/4UVllej2Eq3z7qU24OkV6PqFL/9Lv1qPLd5qjW0AYJsLUe3td1o UiOIlNKUzxAq+vlvfdwTu7cced5GPSuwSV5b6QIeeQGqVc2S7srmJJLTQadlFgj1mhWxW4 J7SdivD4S+GPOwPxv4Kld+9eOCQSK44HwxdVLatwLHHxKk/mmNELoSTOSkTJhGRlt6ozP/ tqcxCSYpkQ3szLCvxEylkqPxxxVFtVvaL1fBONDJxTKZwtPdYYCeTEPvydD0XFZnQp0KSw u18LzNonVgGcuuTkj0z5e6CFpgoKYm7QaaJlmAQKuGTzqwKeAGKKM1yc2Z+LrQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703260210; 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=7VQqYLYmqz+gEm2/K/Zjgxg51SYBUBSwWo2x+jHYQto=; b=mSmpRvEo9e6dW97KEJu6zJKtiME9lsssRte8yCiSb6yudCc9DpODhpU8I7Y9+EGKZLZZly GcdLWGpao4RCUH3jaDDkWbiIAl3cvfF8dLegL/PwJJ8dcpENsPNzOwRkGEGUWmhhmdhGNr n2g5c8UM/NVfImg5/O+DrWg457/TuD/sQuOHvYLpRmudG4yaDoJuoiPRpg+GFAy68W9Rl+ Jt6fZlwhZILF6StgOaQnL52GnOIvL868eJ6I6LxcRO76d/Pgb/MVla5DMPzOfz8Zyu4wVl FahY6A8SIiJfnI9P5pym5KKHwNbOMjUo2ZH6gSolpVEyAKvg/HbEOZmn2KEhAQ== 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 4SxWw23Tt9z7BM; Fri, 22 Dec 2023 15:50:10 +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 3BMFoAtF098645; Fri, 22 Dec 2023 15:50:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BMFoAxj098639; Fri, 22 Dec 2023 15:50:10 GMT (envelope-from git) Date: Fri, 22 Dec 2023 15:50:10 GMT Message-Id: <202312221550.3BMFoAxj098639@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 6d46e2e0a7f3 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 6d46e2e0a7f345459fb42e666c7cb2e987c70857 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6d46e2e0a7f345459fb42e666c7cb2e987c70857 commit 6d46e2e0a7f345459fb42e666c7cb2e987c70857 Author: John Baldwin AuthorDate: 2023-12-22 15:48:47 +0000 Commit: John Baldwin CommitDate: 2023-12-22 15:48:47 +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 --- 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);