From nobody Fri Apr 24 17:56:27 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 4g2LHc09pfz6ZxhR for ; Fri, 24 Apr 2026 17:56:28 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g2LHb5CPnz3qkZ for ; Fri, 24 Apr 2026 17:56:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777053387; 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=fPQftublIZDSD32il1dovbzFmSqR79tFIWBgXU9JDm8=; b=gpTmswK3tRMNzIal4+VCo1XJZp5grEasKCoue83d9wdksI2jPWOkONzXYBfalrmCwTlFWT fc3CHkbCVF+wyAy9vWf0yFKIr8dqiWI1RqbacTpWDwuxKUqTUCqpxAkgDxpeUpr85f9abt IBhnaAuXt+LHXSjwFrczzO6t1hLOCr+QOJRnv2Z2q3+dM7pXJqriUgdpb6DxWOWMj0Ftih mPIw+2B2R62woqIKoVnQFLlSENfcfKBu0IqBolhB7EsbHyeuOfsjCr/AQLfJ44waTyi1MY kSEiICORZSet8u5GN5bbCPf71mnSARdCI3V6EFYROO6N2A45SWwmq1+C8Y8Vaw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777053387; a=rsa-sha256; cv=none; b=QY/yJ/hyQ2nzy9Jcj7ixy2ciUCfHXmhLykr6MlUuUqIBLmGDgnbD0duQddY+RFNBUVNIWL 5/FoZ3f8i/I8E5STQFHJ0tm1YnStBt+DwjNWmtnTCLXmJeSYGTEqfI9rY0pOhYzw4v+nDs YXA/FZZd5NFYwnYF+G6L+7rWKiqZxcgUPkLjSB0sFCa+/xlxBTRtwu6jvx3ciEhaZu9Hbg iF9L5yvVNp1il6gh8eZj/4BPW0AgSkqM7v1aP1LUKNA2CY1k3qNzxI5qvjx4/2R6E+K+3q u1IJ+G4znOmquzzvWPDBFqq0ZQzZd6N8lDMnlvnCp8W+2P1FXQfHY8FBJFLRJg== 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=1777053387; 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=fPQftublIZDSD32il1dovbzFmSqR79tFIWBgXU9JDm8=; b=J4ij2O6mlMBQ539NF5C6ZWVamPqlKOJ+iZiKOOOQcBuCCPv4UPYJy9GIYfmW1Bilp+4TKo A6CyrOq0s/Hq5PGY2iZB9ET0Kr3afnLN8HMQYJg4lL9wOZi2Avys79oPKrbKgPD3mwvyZ1 nE/QI272EGW4FCX/opLEQhpF+l8zqP7RLonDexwjkllEQ3LASOOvk3cYYDKPlq1jatALlb W4Y0vaSAnXkT3xjgHpsVMRldo96CF07+/4cmI6cv7ck9F4ZoN7r9uXBctl/7EH7nt0tsFa oup16T28SqoS5ZsIu/RLdIyXM4JPDDKqQrjoXsjaukuEHIlHYrIbD8u3dH1H3g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g2LHb4gm4z1CnF for ; Fri, 24 Apr 2026 17:56:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e135 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 24 Apr 2026 17:56:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 8fae13b0d261 - stable/15 - LinuxKPI: Fix simple_read_from_buffer for zero-size and off-the-end reads 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/15 X-Git-Reftype: branch X-Git-Commit: 8fae13b0d26198b6ac7ac41e025811e4ee9efdf9 Auto-Submitted: auto-generated Date: Fri, 24 Apr 2026 17:56:27 +0000 Message-Id: <69ebaecb.1e135.48f5f076@gitrepo.freebsd.org> The branch stable/15 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8fae13b0d26198b6ac7ac41e025811e4ee9efdf9 commit 8fae13b0d26198b6ac7ac41e025811e4ee9efdf9 Author: John Baldwin AuthorDate: 2026-03-17 19:49:01 +0000 Commit: John Baldwin CommitDate: 2026-04-24 17:49:14 +0000 LinuxKPI: Fix simple_read_from_buffer for zero-size and off-the-end reads I noticed that the buf_size < 0 check can never be true (it's a size_t) and decided to check for this condition by an alternate expression, and I also noticed that a read_size of 0 would incorrectly return -EFAULT. Instead, return success for both of these cases as reading beyond the EOF of a normal file also returns EOF, not EINVAL. Reviewed by: bz Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D55845 (cherry picked from commit 2353fa1aca553883141a7b5d0aa54312a4610412) --- sys/compat/linuxkpi/common/include/linux/fs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/fs.h b/sys/compat/linuxkpi/common/include/linux/fs.h index 40e1b396fe86..7e28be070850 100644 --- a/sys/compat/linuxkpi/common/include/linux/fs.h +++ b/sys/compat/linuxkpi/common/include/linux/fs.h @@ -368,8 +368,8 @@ simple_read_from_buffer(void __user *dest, size_t read_size, loff_t *ppos, size_t buf_remain = buf_size - *ppos; ssize_t num_read; - if (buf_remain < 0 || buf_remain > buf_size) - return -EINVAL; + if (*ppos >= buf_size || read_size == 0) + return (0); if (read_size > buf_remain) read_size = buf_remain;