aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/controller/pcie-mt7621.c
diff options
context:
space:
mode:
authorSergio Paracuellos <[email protected]>2024-01-11 08:27:04 +0000
committerKrzysztof Wilczyński <[email protected]>2024-04-11 11:33:48 +0000
commitfd6eb49a84a85150d5e9ffbd85d3b102303f9470 (patch)
tree8eacf40702bd101d5ed92b71cdf86a01629198b9 /drivers/pci/controller/pcie-mt7621.c
parentLinux 6.9-rc1 (diff)
downloadkernel-fd6eb49a84a85150d5e9ffbd85d3b102303f9470.tar.gz
kernel-fd6eb49a84a85150d5e9ffbd85d3b102303f9470.zip
PCI: mt7621: Fix string truncation in mt7621_pcie_parse_port()
The following warning appears when driver is compiled with W=1. CC drivers/pci/controller/pcie-mt7621.o drivers/pci/controller/pcie-mt7621.c: In function ‘mt7621_pcie_probe’: drivers/pci/controller/pcie-mt7621.c:228:49: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=] 228 | snprintf(name, sizeof(name), "pcie-phy%d", slot); | ^ drivers/pci/controller/pcie-mt7621.c:228:9: note: ‘snprintf’ output between 10 and 11 bytes into a destination of size 10 228 | snprintf(name, sizeof(name), "pcie-phy%d", slot); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Clean this up increasing destination buffer one byte. [kwilczynski: commit log] Closes: https://lore.kernel.org/linux-pci/20240110212302.GA2123146@bhelgaas/T/#t Link: https://lore.kernel.org/linux-pci/[email protected] Reported-by: Bjorn Helgaas <[email protected]> Signed-off-by: Sergio Paracuellos <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]>
Diffstat (limited to 'drivers/pci/controller/pcie-mt7621.c')
-rw-r--r--drivers/pci/controller/pcie-mt7621.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pci/controller/pcie-mt7621.c b/drivers/pci/controller/pcie-mt7621.c
index 79e225edb42a..d97b956e6e57 100644
--- a/drivers/pci/controller/pcie-mt7621.c
+++ b/drivers/pci/controller/pcie-mt7621.c
@@ -202,7 +202,7 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie,
struct mt7621_pcie_port *port;
struct device *dev = pcie->dev;
struct platform_device *pdev = to_platform_device(dev);
- char name[10];
+ char name[11];
int err;
port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);