From nobody Thu Jan 18 22:25:59 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 4TGHQH6xzVz578Qx; Thu, 18 Jan 2024 22:25:59 +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 4TGHQH3z7Qz40x0; Thu, 18 Jan 2024 22:25:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705616759; 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=Myx7/zcNo5AqYF52yMzqtYD/efEV+Fj3MwgxLONOa60=; b=ppM/QaJPQhITpWAeFxpq5nQ2EOK6jDkoc6/uVyPLiBi0ofZyC0YaE8Ba7Zbn+9BaPzeqK2 S3YL2iYnCQnjOUZOsNfaTr76gpEIPfWBnOCZ6vP09UoUg/YFdofh+AVKCd+OcC1xLoDp9/ lP1+OSaPnqwKZ3RPuRvYkVk59H++dnqqyo1xzu4MmOCQFKwGxMoTP8cdeT4RXYzCkXOzhb 7L4q3SW13KQOBs0HtWUOsqbZuo5pO++QeuKYOEMOM3I4Bd66SgLRRidswOQfV1fcdz19Gt wwqFDnogmVYhhWozyomakBFSlWnYyDgDUP7b3iWugRuaoWPUG6hQAxgAlLTYAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705616759; 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=Myx7/zcNo5AqYF52yMzqtYD/efEV+Fj3MwgxLONOa60=; b=d/sWfREHE0d0bYITR4TSJO02wvhty6tDoPwTQw+AVMIqlRQbYDsXiVPM+Cjr6li4TS/D/Q CkGgaWplmaxXLFE3FeWgUXgGPEtJ8zXpUDQQMeOChzxaS3oNOcuDDdVDL0Q+tV7lkpZ8oz 368Fj5EyAMuLCnJI+aWdJsKGcct4HefWppjEnNcgs80r82qKZw4efMDeCbJqjH8obHa9u8 ZLuCrJq1zUz6zfreIOXMTQZxeXiwepr1DRb7NpE5ujw/Z+0mLxQxwKuK/3cNrqLr4A/FA4 Cdq+on94yPrSBbOnC5bpQxIzNx7QEtbtBC0YyH7HyW9b/toYEoP5pAaROy2HFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705616759; a=rsa-sha256; cv=none; b=XLh/nw/SmRyRfpRkPv9cMkikkixxxmAzFzCeQ41HIOngPG0Riou3nWKzYcFqr+DyV7W7qe QkLe6Rje45/kqLVfpS+brApHd7E6fuO5F0WF0BBD4VxtzQLXlWRECHCyQ9Av4Ns2Cb8H3h +KJHdIhFUerCDHJhgOhYwl64Jvun4Ru09y6Ota+npt6wHVlzR+yA0eDC9XGjkM2yg+IcLl Oo2Lqv0bOqZ2zoJtRs+GYreDAK+vcSPfjOzXUMAd+DvoiT8DrmGgEWWVJAEuQBtgn/bArU k3Rt1WIpAf9cNhBOGweaDG83nBhPF+bmvSKmfIlAO3nKePuho7/HmS1+4+PGrA== 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 4TGHQH2YrdzQWd; Thu, 18 Jan 2024 22:25:59 +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 40IMPxOq089429; Thu, 18 Jan 2024 22:25:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40IMPxfx089426; Thu, 18 Jan 2024 22:25:59 GMT (envelope-from git) Date: Thu, 18 Jan 2024 22:25:59 GMT Message-Id: <202401182225.40IMPxfx089426@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: 38effbdd2d8a - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 38effbdd2d8a033e1221d309517c4d4418018ec3 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=38effbdd2d8a033e1221d309517c4d4418018ec3 commit 38effbdd2d8a033e1221d309517c4d4418018ec3 Author: John Baldwin AuthorDate: 2023-12-22 15:49:03 +0000 Commit: John Baldwin CommitDate: 2024-01-18 21:31:20 +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)