From nobody Sat Aug 9 12:36:04 2025 X-Original-To: dev-commits-src-main@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 4bzgP12yQ0z64C8k; Sat, 09 Aug 2025 12:36:05 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bzgP10JQxz3m8N; Sat, 09 Aug 2025 12:36:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754742965; 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=2haxlBLvvPqnbw3i0Lzm37oGv/kHvSEe3u2wZEtrm/w=; b=tGJWnKYSAaFzptYmI4ZzRq3JytgutW9E/nZ252YSqfI9gTa1n1Bn63hOy3AfiWVoIou7N3 R39ovWCURzT10bsclN1I/ifb1XsDofJS3AzSSYvXC9E4dpjYj5hWbIkSmxoGqH9KDaj1tp iJ7YPLFqLc16pDFgjSEOIuqfgu9PMJBRlJ72Kz0QmK48sr3juC1P/s6Mwe2Ll5coJqWnvv Hf89A1hadN4rkaVWKMqnJclwMoniWne1xGt8NjB40Zz82hlCvwVbuBd4uyL0ordAxRvrx4 WQRD5mp274enc3oPR0rAIpAJ4jXWy63Mr04gKWfPs8uYlTJj1ziBDfSsRrcRYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754742965; 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=2haxlBLvvPqnbw3i0Lzm37oGv/kHvSEe3u2wZEtrm/w=; b=Rk785sVHlL0AjtC6yjXxcVW1CbJhVFjIZyNYAqh/suM91pmQ+AlUhbNQ7a0BTp42vZwQMV 8tmj2RzXUSP6R5bxBnm/mfNyMkoO6pOC1E8Z858mb8xICNDrQHoRh+4kXViIfruZegr+Cw BAJuSF9gtwK/wz1Z6iGjsqjyT+5pE9crWJuwZEQiZkZAiySZSetw4ZMBTHr5D6XnUL2NP9 eYk31LD7z1SxMd8VRuA/46pFBZ0jW6BwOQAw5TAik9cDkgMa3kIpKiDavQ+7Jd3m49k81v LYDPqicG8/yPcfYOPKhO2OXwqqAGKA7D8WnF7XDGtxnMAkpIOvWGXMDmYrWTYA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754742965; a=rsa-sha256; cv=none; b=WFe5NBgJOT90JJdbz/sClxGGnYZEByW3nG9X1QnD6d7XkRbKkJxNsPCNVPCTe7au97vZIA wONvY7ozoz/Xf3WY1Ljwve61/JxZDkISuTFnI2nUfxeIJr9ihygdn8sQkpSArjfC5tWLvd CE47YJHaD9So6voaQHnlYjAq8ZGFdrWvnU6F8qdsojxFLbamoeRIfmsH/pu7DtQqnFyX1J SEA493MFBMrCOhMYefc10fVjz6FdE7gJ4rtFUNarL9wZNp2oyavpOVJMyn+9Y/u+p4KZtL KDMc8WSYW1ysp1Xs0WDWqSvueNRAf678JtsGnYgNraXM2Nr8ARkXKbz7Nm92LQ== 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 4bzgP06tzvz682; Sat, 09 Aug 2025 12:36:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 579Ca4V3020815; Sat, 9 Aug 2025 12:36:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 579Ca4me020812; Sat, 9 Aug 2025 12:36:04 GMT (envelope-from git) Date: Sat, 9 Aug 2025 12:36:04 GMT Message-Id: <202508091236.579Ca4me020812@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien?= =?utf-8?Q?P=C3=A9dron?= Subject: git: f0e445912658 - main - linuxkpi: Update posittion after copy in `seq_read()` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0e445912658eeb80aa0bf156e778be9185e31bc Auto-Submitted: auto-generated The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=f0e445912658eeb80aa0bf156e778be9185e31bc commit f0e445912658eeb80aa0bf156e778be9185e31bc Author: Jean-Sébastien Pédron AuthorDate: 2025-07-10 23:04:29 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2025-08-09 12:26:25 +0000 linuxkpi: Update posittion after copy in `seq_read()` `seq_read()` is usually called in a loop because the destination buffer might be smaller than the source. The caller relies on the updated position to read what is next. We also use `memcpy()` instead of `strscpy()` because we don't need to append a NUL character. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51560 --- sys/compat/linuxkpi/common/src/linux_seq_file.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_seq_file.c b/sys/compat/linuxkpi/common/src/linux_seq_file.c index 8b426825cc78..9c06fe27bebe 100644 --- a/sys/compat/linuxkpi/common/src/linux_seq_file.c +++ b/sys/compat/linuxkpi/common/src/linux_seq_file.c @@ -64,13 +64,10 @@ seq_read(struct linux_file *f, char *ubuf, size_t size, off_t *ppos) return (-EINVAL); size = min(rc - *ppos, size); - rc = strscpy(ubuf, sbuf_data(sbuf) + *ppos, size + 1); + memcpy(ubuf, sbuf_data(sbuf) + *ppos, size); + *ppos += size; - /* add 1 for null terminator */ - if (rc > 0) - rc += 1; - - return (rc); + return (size); } int