From nobody Thu Nov 05 19:33:03 2026 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 4jLCC364QGz6y3F2 for ; Thu, 05 Nov 2026 19:33:03 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jLCC32JfGz3KL9 for ; Thu, 05 Nov 2026 19:33:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793907183; 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=jmGJCSFyjBPPnHqr2beVbsixupFNu7bYL/86LvYEpZ4=; b=whGzTQfYOkS83FLyb5amWUk9v4JFlQOcQz7WQZjW7BDqGqBdGLaN1krypLjsoKRcay9bE8 CVxj8ZB5Hp//BT/AVdkwfv4d+bRShlTLZVVdHS/ld7cbsmse/4UynNs7B/M2ikTvVs/Pnj q1BV82T7iZcnldv5JDGDtsBDcRJ00NmTY7qkEJRjY4wi+NmI5chJXNqyTdQBTOndKgNF9V y/4IsKDy8RZYSKCwjxKBiw+TT5Htqz7uul1GRLJNIuEAgtlnUve1G+x2d6D1JbVjopsNqj F0vrwoijCjlJbkJTD14XKgxxzhM91tCyY1x/YLEKJF3h58x5f9vrCQNE2cmZAw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793907183; b=fX0fNXju6bRY9Nrw1o0nTOw2QdLo09KfA201ER8mr01mMIiHtgz5IFDaVaT8yjQ9LdmOnb 4D075apdUUlAYk1YXGGwpbl7Y1l6nqFKarK4ULAZs42EcTOVPqDbtodpmG9XuQvPN2dT/9 sxtMwPWm6rCPa3GQMmbfFcMGhBf03TZYqdRtjcwx/70c2GRmHDvUExygSx8tDMkhzJ9Ff5 KIIukRrwXgmEops+4uAxfLL5p28fAhlfh88LeAMRciRcTW16wlDj6PvSLjoIF2hMSH9dKV km8sbXCB5F641+pdi+KdklBr4ywWjJrbJQE0q3UJAa/717O3CQl1fKf6LjYwPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793907183; 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=jmGJCSFyjBPPnHqr2beVbsixupFNu7bYL/86LvYEpZ4=; b=RPJfMw55eua/YXvhiQ27UjrUQmoA1WbZ2n28zqU83SOnvmBrO9Nxss2xCJmm55KYz2Gqq3 CWDOpkkxtVlNjeh8mfVSf8nBY5avfT7ikBh2Nm9yQf2YJLvN9LfGMtOkkACJdBS3PYXQh6 fw72qj1aDrB+9rnn0hJxaRIE2hzwdRyHwlkic4fylCOCv2lmfMf7HDt2VvxDeZgoXYlC/W Agf9jleXOOb95DuKddcXsLtz0Y5y3vc1LgPji40Q2wDT2y8Nakc+bsUohnDPozmMqBh7mu oTdk5HJORMhyBcOl8PnDRyyljPx81YQnmIbB19wTDpHNmCY8ZvmhcsxlP9XwDw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jLCC31xbdz13xv for ; Thu, 05 Nov 2026 19:33:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 460ef by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 05 Nov 2026 19:33:03 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 97b359e7b76a - stable/14 - tarfs: Fix length calculation for file read List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 97b359e7b76a29bbcbf6c366218f36fa76380a34 Auto-Submitted: auto-generated Date: Thu, 05 Nov 2026 19:33:03 +0000 Message-Id: <6aecd9ef.460ef.1b6928bc@gitrepo.freebsd.org> The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=97b359e7b76a29bbcbf6c366218f36fa76380a34 commit 97b359e7b76a29bbcbf6c366218f36fa76380a34 Author: Dag-Erling Smørgrav AuthorDate: 2026-11-02 12:29:25 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-11-05 17:45:33 +0000 tarfs: Fix length calculation for file read When the offset is within a block rather than at its beginning, the length should be clamped to the remaining length of the block, not its total length. Reported by: n0ps1ed MFC after: 1 week Reviewed by: markj, emaste Differential Revision: https://reviews.freebsd.org/D60904 (cherry picked from commit 18bce6e65cdf059618ff12ace82a9f7334e1b610) --- sys/fs/tarfs/tarfs_subr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/fs/tarfs/tarfs_subr.c b/sys/fs/tarfs/tarfs_subr.c index 180e0a53f8b9..0cb5eec8c385 100644 --- a/sys/fs/tarfs/tarfs_subr.c +++ b/sys/fs/tarfs/tarfs_subr.c @@ -428,7 +428,7 @@ tarfs_read_file(struct tarfs_node *tnp, size_t len, struct uio *uiop) TARFS_DPF(VNODE, "%s(%s, %zu, %zu)\n", __func__, tnp->name, uiop->uio_offset, resid); for (i = 0; i < tnp->nblk && resid > 0; ++i) { - if (uiop->uio_offset > tnp->blk[i].o + tnp->blk[i].l) { + if (uiop->uio_offset >= tnp->blk[i].o + tnp->blk[i].l) { /* skip this block */ continue; } @@ -456,7 +456,8 @@ tarfs_read_file(struct tarfs_node *tnp, size_t len, struct uio *uiop) while (resid > 0 && uiop->uio_offset < tnp->blk[i].o + tnp->blk[i].l) { /* now actual data */ - copylen = tnp->blk[i].l; + copylen = tnp->blk[i].l - + (uiop->uio_offset - tnp->blk[i].o); if (copylen > resid) copylen = resid; auio = *uiop;