[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200509091849.116954-2-chenzhou10@huawei.com>
Date: Sat, 9 May 2020 17:18:48 +0800
From: Chen Zhou <chenzhou10@...wei.com>
To: <davem@...emloft.net>
CC: <sparclinux@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<chenzhou10@...wei.com>
Subject: [PATCH -next 1/2] sparc: use snprintf() 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@...wei.com>
---
arch/sparc/kernel/pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 5ed43828e078..a41ad562ed4e 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -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);
--
2.20.1
Powered by blists - more mailing lists