From nobody Tue Mar 17 19:50:29 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 4fb2cj70Fmz6VWFX for ; Tue, 17 Mar 2026 19:50:29 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fb2cj4Szgz40NK for ; Tue, 17 Mar 2026 19:50:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1773777029; 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=RF91hCmyi8WOmErPNa/tP7prJ7hilsy/aqZPmOV6CCs=; b=W4PLmvtv9JVrcFPZURtyLILQt8buN3Jqc2UOrCzm/Yfa2ztKIGxLI7Lw3V/B5z75SDdeqi fe/86S2b3Rq/py4MaH8J6qeWgUYru/mvFT8RmiXLRAGsCSM4ouXtBKdn/JcY4U+PcWelJp 3NYJekz+atR2ypGvPFIdmYau06V/3h9mieN/O1WRwL7ZOdkAOmOHvM1R1w1wv43pEmLsq0 w1VoMg1VfVq/COBnJcu2ia9JLyF9kQWn4Y1+RkZVdU0RdHYFpy554OV+G0Jn85OHXxuiET Zz81xByT1NnEyc/pZpc7WBoNDU72KF8nlUx0UVgE5dtx+pcGHmX15tasHf8Ujg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1773777029; a=rsa-sha256; cv=none; b=khh/PfR1oZCouN5jUh6NwZeh39hx5LRWdxmRCEhZUcBRC2TaS+sirItyXYqU3PKH71dnZs U5GSItcMg4P7M8OT+ELLZPqtIdu0cMLkzWuM34PsK/4IvCUqHA4Vuh42hMUkCvlVisGlhk 6g+SiMTWTTCFczWbuF/ZCF3jOTODjvz4CAfXENC4E8QJMqt+Utu6NLNlZjxLjY6KGDQ+j/ qaX6SiKMIdirkGAUaYrjk+cOv2Lruxh0YiGmPE4iDxXkCDko5B/8KOC+QWqaUfDMFr+4w3 IK+lvroiG0HR1RBvYTDTGepAWsVQCRAGWdXslpZ9NfjC3CXA/IgJZ9CrgFad8g== 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=1773777029; 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=RF91hCmyi8WOmErPNa/tP7prJ7hilsy/aqZPmOV6CCs=; b=U5bVFExLLyT9b5pjGwOZiDcwIzXbVJVVQ8cYuAEBQXjKWni2Dujr1TpqNxnClu1CEKTokG Knn6J7O9/X+EGsPAsfo2rSGgugTYqf8rSIT6pkDyUqsq28y5CKbOWR/inwhwYUezwWP+7V kncG771fWhcmA2TeGL4BsV6F4L8wCarKWzlpVAa50ikFpFzj1Nbx/okyYKUsf82wC4SEMk OD/T6MBUNTvz0kVPiSNC7lUb9zJ9CPlN4npoB6AgGmONzV/aEBP5j35kDsxgpay4x5gzLo 9MKDUYPyo1C5WkvT1AhKIusB6/khezZiUFYLyWdgykeCBLTARE96Ff3DkOUl7w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fb2cj3b59zccl for ; Tue, 17 Mar 2026 19:50:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c19d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Mar 2026 19:50:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 2353fa1aca55 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 2353fa1aca553883141a7b5d0aa54312a4610412 Auto-Submitted: auto-generated Date: Tue, 17 Mar 2026 19:50:29 +0000 Message-Id: <69b9b085.3c19d.500e7505@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2353fa1aca553883141a7b5d0aa54312a4610412 commit 2353fa1aca553883141a7b5d0aa54312a4610412 Author: John Baldwin AuthorDate: 2026-03-17 19:49:01 +0000 Commit: John Baldwin CommitDate: 2026-03-17 19:49:01 +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 --- 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;