From: Joe Perches <joe@perches.com>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>,
stefanr@s5r6.in-berlin.de
Cc: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] firewire: convert sysfs sprintf/snprintf family to sysfs_emit
Date: Wed, 03 Feb 2021 23:05:22 -0800 [thread overview]
Message-ID: <d4c12ffbfca8a66ddaa3224296e964ecf9aa0705.camel@perches.com> (raw)
In-Reply-To: <1612421432-39124-1-git-send-email-jiapeng.chong@linux.alibaba.com>
On Thu, 2021-02-04 at 14:50 +0800, Jiapeng Chong wrote:
> Fix the following coccicheck warning:
>
> ./drivers/firewire/core-device.c:375:8-16: WARNING: use scnprintf or
> sprintf.
[]
> diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
[]
> @@ -372,8 +372,7 @@ static ssize_t rom_index_show(struct device *dev,
> struct fw_device *device = fw_device(dev->parent);
> struct fw_unit *unit = fw_unit(dev);
>
>
> - return snprintf(buf, PAGE_SIZE, "%d\n",
> - (int)(unit->directory - device->config_rom));
> + return sysfs_emit(buf, "%d\n", (int)(unit->directory - device->config_rom));
Perhaps this should use the ptrdiff_t qualifier '%td' instead:
return sysfs_emit(buf, "%td\n", unit->directory - device->config_rom);
prev parent reply other threads:[~2021-02-04 7:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-04 6:50 Jiapeng Chong
2021-02-04 7:05 ` Joe Perches [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=d4c12ffbfca8a66ddaa3224296e964ecf9aa0705.camel@perches.com \
--to=joe@perches.com \
--cc=jiapeng.chong@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=stefanr@s5r6.in-berlin.de \
/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®