Skip to content

Commit

Permalink
sparc: use scnprintf() in show_pciobppath_attr() in pci.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chen Zhou authored and David S. Miller committed May 13, 2020
1 parent 9ef391b commit 03a1b56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/sparc/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ show_pciobppath_attr(struct device * dev, struct device_attribute * attr, char *
pdev = to_pci_dev(dev);
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);
Expand Down

0 comments on commit 03a1b56

Please sign in to comment.