[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d4c12ffbfca8a66ddaa3224296e964ecf9aa0705.camel@perches.com>
Date: Wed, 03 Feb 2021 23:05:22 -0800
From: Joe Perches <joe@...ches.com>
To: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
stefanr@...6.in-berlin.de
Cc: linux1394-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] firewire: convert sysfs sprintf/snprintf family to
sysfs_emit
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);
Powered by blists - more mailing lists