sparc: use scnprintf() in show_pciobppath_attr() in vio.c
authorChen Zhou <chenzhou10@huawei.com>
Sat, 9 May 2020 09:18:49 +0000 (17:18 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 May 2020 22:35:58 +0000 (15:35 -0700)
snprintf() returns the number of bytes that would be written,
which may be greater than the the actual length to be written.

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

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/kernel/vio.c

index c7cad9b7bba73617a995a12d8d770fb2390e676e..4f57056ed463ad7c9b8eb9ec30e82da236cdbd66 100644 (file)
@@ -193,7 +193,7 @@ show_pciobppath_attr(struct device *dev, struct device_attribute *attr,
        vdev = to_vio_dev(dev);
        dp = vdev->dp;
 
-       return snprintf (buf, PAGE_SIZE, "%pOF\n", dp);
+       return scnprintf(buf, PAGE_SIZE, "%pOF\n", dp);
 }
 
 static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH,