Messages in this thread | ![/](/images/icornerl.gif) | | Date | Fri, 17 May 2024 20:29:29 +0900 | From | Krzysztof Wilczyński <> | Subject | Re: [PATCH] PCI: mt7621: Fix possible string truncation in snprintf |
| |
Hello,
> 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.
Applied to controller/mt7621, thank you!
[1/1] PCI: mt7621: Fix string truncation in mt7621_pcie_parse_port() https://git.kernel.org/pci/pci/c/fd6eb49a84a8
Krzysztof
| ![\](/images/icornerr.gif) |