linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/IOV: "virtfn4294967295\0" requires 17 bytes
@ 2022-12-18  3:33 Alexey V. Vissarionov
  2022-12-18 10:57 ` Krzysztof Wilczyński
  0 siblings, 1 reply; 9+ messages in thread
From: Alexey V. Vissarionov @ 2022-12-18  3:33 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Alexey V. Vissarionov, Jesse Barnes, Matthew Wilcox, Yu Zhao,
	linux-pci, lvc-project

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]


Although unlikely, the 'id' value may be as big as 4294967295
(uint32_max) and "virtfn4294967295\0" would require 17 bytes
instead of 16.

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

Fixes: dd7cc44d0 ("PCI: add SR-IOV API for Physical Function driver")
Signed-off-by: Alexey V. Vissarionov <gremlin@altlinux.org>
---
 drivers/pci/iov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-PCI-IOV-virtfn4294967295-0-requires-17-bytes.diff --]
[-- Type: text/x-patch; name="0001-PCI-IOV-virtfn4294967295-0-requires-17-bytes.diff", Size: 306 bytes --]

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 9522175..ad54a07 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -14,7 +14,7 @@
 #include <linux/delay.h>
 #include "pci.h"
 
-#define VIRTFN_ID_LEN	16
+#define VIRTFN_ID_LEN	17
 
 int pci_iov_virtfn_bus(struct pci_dev *dev, int vf_id)
 {

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-01-12 23:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-18  3:33 [PATCH] PCI/IOV: "virtfn4294967295\0" requires 17 bytes Alexey V. Vissarionov
2022-12-18 10:57 ` Krzysztof Wilczyński
2022-12-18 12:21   ` Alexey V. Vissarionov
2022-12-18 22:19     ` Matthew Wilcox
2022-12-18 23:24       ` Alexey V. Vissarionov
2022-12-19 10:16       ` Niklas Schnelle
2022-12-29 18:12       ` Bjorn Helgaas
2022-12-29 21:09         ` Matthew Wilcox
2023-01-12 23:00     ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).