s390: use scnprintf() in sys_##_prefix##_##_name##_show
authorChen Zhou <chenzhou10@huawei.com>
Sat, 9 May 2020 08:56:07 +0000 (16:56 +0800)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 16 Jun 2020 11:44:05 +0000 (13:44 +0200)
snprintf() returns the number of bytes that would be written,
which may be greater than the the actual length to be written.

show() methods should return the number of bytes printed into the
buffer. This is the return value of scnprintf().

Link: https://lkml.kernel.org/r/20200509085608.41061-3-chenzhou10@huawei.com
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/kernel/ipl.c

index ccea9a245867a15f249840e1200e912d3bde139a..90a2a17239b0e252602d2d3c681deaf2a1a7911c 100644 (file)
@@ -181,7 +181,7 @@ static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \
                struct kobj_attribute *attr,                            \
                char *page)                                             \
 {                                                                      \
-       return snprintf(page, PAGE_SIZE, _format, ##args);              \
+       return scnprintf(page, PAGE_SIZE, _format, ##args);             \
 }
 
 #define IPL_ATTR_CCW_STORE_FN(_prefix, _name, _ipl_blk)                        \