Messages in this thread | | | Subject | Re: [PATCH] firewire: convert sysfs sprintf/snprintf family to sysfs_emit | From | Joe Perches <> | Date | Wed, 03 Feb 2021 23:05:22 -0800 |
| |
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);
| |