sparc: use scnprintf() in show_pciobppath_attr() in pci.c

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>
This commit is contained in:
Chen Zhou 2020-05-09 17:18:48 +08:00 коммит произвёл David S. Miller
Родитель 9ef391bdc2
Коммит 03a1b56f50
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -593,7 +593,7 @@ show_pciobppath_attr(struct device * dev, struct device_attribute * attr, char *
pdev = to_pci_dev(dev); pdev = to_pci_dev(dev);
dp = pdev->dev.of_node; dp = pdev->dev.of_node;
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, show_pciobppath_attr, NULL); static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH, show_pciobppath_attr, NULL);