firewire: replace snprintf in show functions with sysfs_emit
PATCH 1/1 firewire: replace snprintf in show functions with sysfs_emit
show() must not use snprintf() when formatting the value to be returned to user space.
Fix the following coccicheck warning:drivers/firewire/core-device.c:377: WARNING: use scnprintf or sprintf. drivers/firewire/core-device.c:408: WARNING: use scnprintf or sprintf.
Signed-off-by Qing Wang <[email protected]>
--- drivers/firewire/core-device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firewire/core-device.c +2 -2
@@ -374,7 +374,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" , +return sysfs_emit (buf,"%d\n" , (int )(unit->directory - device->config_rom)); }
@@ -405,7 +405,7 @@ static ssize_t guid_show(struct device *dev,int ret;down_read (&fw_device_rwsem); - ret =snprintf (buf,PAGE_SIZE ,"0x%08x%08x\n" , + ret =sysfs_emit (buf,"0x%08x%08x\n" , device->config_rom[3 ], device->config_rom[4 ]);up_read (&fw_device_rwsem);
Signature · 1 line
2.7.4