All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexey V. Vissarionov" <gremlin@altlinux.org>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: "Alexey V. Vissarionov" <gremlin@altlinux.org>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	Matthew Wilcox <willy@infradead.org>, Yu Zhao <yu.zhao@intel.com>,
	linux-pci@vger.kernel.org, lvc-project@linuxtesting.org
Subject: [PATCH] PCI/IOV: "virtfn4294967295\0" requires 17 bytes
Date: Sun, 18 Dec 2022 06:33:47 +0300	[thread overview]
Message-ID: <20221218033347.23743-1-gremlin@altlinux.org> (raw)

[-- 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)
 {

             reply	other threads:[~2022-12-18  3:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-18  3:33 Alexey V. Vissarionov [this message]
2022-12-18 10:57 ` [PATCH] PCI/IOV: "virtfn4294967295\0" requires 17 bytes 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221218033347.23743-1-gremlin@altlinux.org \
    --to=gremlin@altlinux.org \
    --cc=bhelgaas@google.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=willy@infradead.org \
    --cc=yu.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.