From nobody Thu Jan 18 22:26:30 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 4TGHQt72z1z578RX; Thu, 18 Jan 2024 22:26:30 +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 4TGHQt4Qk4z42Qm; Thu, 18 Jan 2024 22:26:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705616790; 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=5IrVhxif9b8cYRkVjGot/oH/+Kt77BgCqO3zYoeJEog=; b=Ikrd/boyfq7VzZ20TB0AD1sSiAHTv1aoVGBYSLEqINRNChWLkbqMsM7CLRJdzHZ/77UUyP 4RHCC/NkOXkv7phfbn07sx6HqgBhLekSjBsg7Pl2MC8fwAbeAyOcz2K5V2X+48oRbMG/xd tXoarJ31z72u/Ib0ekipUhMgqQzPByFSz4K5J3+2SykGwAI/KhEpWCj1do0uejeiknuXuS v0orXTsuvgEu45ew89aMYSo8vDsFmKW1r0dMzh6gcJd3xA8Bpovvd7/V6eRKTIj5lK3em1 vAn1DxywIqo5OjXslFIX3+546XTG7KtCPT71KKYDJtmr5J+MmZ7IOHonCHeThQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705616790; 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=5IrVhxif9b8cYRkVjGot/oH/+Kt77BgCqO3zYoeJEog=; b=bEQ2QpTm7Fx6Uj88Qg4yZLNyv0HAt9ddbs54NYeJOFJ+y2cpkirLHglw6K6ZQE4bHB1FFb IMMPF7qQ3lenoujIqOpmmgRyuRUxaEB9e+PZ1qnYRj/61cZGyAr5BDRi1CEOVbPKsyNEiQ AwSyw5MZACVy6pKAs4WOF/cv4WyjlikCDWHpOLI7cHO4mkaIrzQUVkLSJRaWXyMUeaEriv yekfEN7ad/rMqCP/DvPdLvaD4WfkrZmpGJH4VQSMI2ec9JF9MmZTbNqlIl4rZVoP40we2z Fr6g7QYBq+8bFO8lcyIitHFcx2IMDvaFgdZmvuadmdWfiGPz9thUoTXBUeR5KA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705616790; a=rsa-sha256; cv=none; b=GSz8xfT9JikkiYlNJasw5xiJl0JzWCgh2lm1Ok0cE9QfwVm2UAKo4rornlK8xPs/xzxt6Y 0Pi6G56ldmRDiygGE1HuLnlulUjuzFj1AsDk9BxW3ytCQsMhimLveESNpJGm99+/3798Fs 1g2sLfOqWU7Ovot2hci0ETgZzc7ZqCEHqth5AOj1Ml9v9FlcsXxaWNraqqfdH/lnuQNJn8 0DpBiWdl/Zk3q8OWFSs6LWXmy1kl1p20cNqd2xt7Y4KQIaAfxiPNi3sZfu38aXmOrApiJV g5LmFJRGDdciK+jU6brsqft3ZO1rY+pdoITT7JzcNUhaDRtmoUvTPKW4nZhDpQ== 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 4TGHQt3WjvzQ6b; Thu, 18 Jan 2024 22:26:30 +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 40IMQU2N090556; Thu, 18 Jan 2024 22:26:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40IMQUNV090553; Thu, 18 Jan 2024 22:26:30 GMT (envelope-from git) Date: Thu, 18 Jan 2024 22:26:30 GMT Message-Id: <202401182226.40IMQUNV090553@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: ea717376822e - stable/13 - kldxref: Simplify elf_read_raw_data 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: ea717376822edc921a66f8b149ba3b6ca7536e8a Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ea717376822edc921a66f8b149ba3b6ca7536e8a commit ea717376822edc921a66f8b149ba3b6ca7536e8a Author: John Baldwin AuthorDate: 2023-12-22 15:49:03 +0000 Commit: John Baldwin CommitDate: 2024-01-18 21:31:22 +0000 kldxref: Simplify elf_read_raw_data Use pread as a valid offset is always passed now. Originally the DSO code read the .hash section in two separate requests and relied on the implicit offset for the second read, but now the hash table is fetched in a single call. Reviewed by: imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D43125 (cherry picked from commit ed96fd7fc652d77ae5e34727e54610e87854defc) --- usr.sbin/kldxref/elf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/usr.sbin/kldxref/elf.c b/usr.sbin/kldxref/elf.c index f8a6510ed352..cc9bf9e6cb38 100644 --- a/usr.sbin/kldxref/elf.c +++ b/usr.sbin/kldxref/elf.c @@ -170,11 +170,7 @@ elf_read_raw_data(struct elf_file *efile, off_t offset, void *dst, size_t len) { ssize_t nread; - if (offset != (off_t)-1) { - if (lseek(efile->ef_fd, offset, SEEK_SET) == -1) - return (EIO); - } - nread = read(efile->ef_fd, dst, len); + nread = pread(efile->ef_fd, dst, len, offset); if (nread == -1) return (errno); if (nread != len)