From: Andrew Morton <akpm@linux-foundation.org>
To: "Shengzhuo Wei" <me@cherr.cc>
Cc: "John Stultz" <johnstul@us.ibm.com>, "Yao Zi" <me@ziyao.cc>,
<linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
John Stultz <jstultz@google.com>
Subject: Re: [PATCH] proc: fix comm_write return value when truncated or error
Date: Fri, 24 Apr 2026 06:35:31 -0700 [thread overview]
Message-ID: <20260424063531.d1508a3c79c4b7808ed04420@linux-foundation.org> (raw)
In-Reply-To: <20260424-fix_proc_write_return-v1-1-7a793c2aad32@cherr.cc>
On Fri, 24 Apr 2026 04:06:21 +0800 "Shengzhuo Wei" <me@cherr.cc> wrote:
> When count exceeds TASK_COMM_LEN-1, comm_write() copies at most
> TASK_COMM_LEN-1 bytes but returns the original count. This violates
> write(2) semantics, which require returning the number of bytes
> actually written.
>
> The count parameter is size_t and should not be repurposed to carry a
> negative error code on the same_thread_group() failure path.
>
> Introduce a local len for the truncated length and a separate ssize_t
> ret for the return value.
AI review asks a good question:
https://sashiko.dev/#/patchset/20260424-fix_proc_write_return-v1-1-7a793c2aad32@cherr.cc
prev parent reply other threads:[~2026-04-24 13:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 20:06 [PATCH] proc: fix comm_write return value when truncated or error Shengzhuo Wei
2026-04-24 10:50 ` Andrew Morton
2026-04-24 13:28 ` Alexey Dobriyan
2026-04-24 18:03 ` Shengzhuo Wei
2026-04-24 18:52 ` Alexey Dobriyan
2026-04-24 13:35 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260424063531.d1508a3c79c4b7808ed04420@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=johnstul@us.ibm.com \
--cc=jstultz@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=me@cherr.cc \
--cc=me@ziyao.cc \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox