lkml.org 
[lkml]   [2021]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] firewire: convert sysfs sprintf/snprintf family to sysfs_emit
From
Date
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);


\
 
 \ /
  Last update: 2021-02-04 08:06    [W:0.060 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site