]> git.baikalelectronics.ru Git - kernel.git/commitdiff
PCI/IOV: Enlarge virtfn sysfs name buffer
authorAlexey V. Vissarionov <gremlin@altlinux.org>
Sun, 18 Dec 2022 03:33:47 +0000 (06:33 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:31 +0000 (09:33 +0100)
[ Upstream commit 0978a9dbd5d2420b4b439839e28391795c50704f ]

The sysfs link name "virtfn%u" constructed by pci_iov_sysfs_link() requires
17 bytes to contain the longest possible string.  Increase VIRTFN_ID_LEN to
accommodate that.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

[bhelgaas: commit log, comment at #define]
Fixes: 27f88952acc5 ("PCI: add SR-IOV API for Physical Function driver")
Link: https://lore.kernel.org/r/20221218033347.23743-1-gremlin@altlinux.org
Signed-off-by: Alexey V. Vissarionov <gremlin@altlinux.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/iov.c

index 952217572113c02471cf095b531c7adfb1526bdf..b2e8322755c173c9c3f983933d99e3014cfd932d 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/delay.h>
 #include "pci.h"
 
-#define VIRTFN_ID_LEN  16
+#define VIRTFN_ID_LEN  17      /* "virtfn%u\0" for 2^32 - 1 */
 
 int pci_iov_virtfn_bus(struct pci_dev *dev, int vf_id)
 {