From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] firewire: core: clean up modalias buffer handling
Date: Mon, 30 Mar 2026 09:57:48 +0900 [thread overview]
Message-ID: <20260330005748.GA115569@sakamocchi.jp> (raw)
In-Reply-To: <20260329211940.371395-2-thorsten.blum@linux.dev>
Hi,
Thanks for sending your patch.
On Sun, Mar 29, 2026 at 11:19:40PM +0200, Thorsten Blum wrote:
> Use scnprintf() in get_modalias() to return the number of characters
> actually written to the destination buffer.
>
> Also reserve space for the trailing newline in modalias_show() and
> append it explicitly, instead of using strcpy() and relying on the
> formatted modalias to fit within PAGE_SIZE.
>
> While the current code is safe, this makes the sysfs buffer handling
> more explicit and consistent.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/firewire/core-device.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
I previously considered using sysfs_emit(_at)() in the code, but decided
against it because the code is called in both sysfs and the workqueue
context of firewire devices. The buffer size differs between these cases
(either PAGE_SIZE or 64).
In any case, as you already noted, the current code is enough safe. The
total length of formatted string is fixed (= 41 + 1) by the format
template, so it is unlikely to cause issues. I have little motivation to
change it.
Thanks
Takashi Sakamoto
prev parent reply other threads:[~2026-03-30 0:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-29 21:19 Thorsten Blum
2026-03-30 0:57 ` Takashi Sakamoto [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=20260330005748.GA115569@sakamocchi.jp \
--to=o-takashi@sakamocchi.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=thorsten.blum@linux.dev \
/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
all inboxes | Powered by JetHome®