Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109564718
D35328.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D35328.diff
View Options
diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -2168,9 +2168,10 @@
static int
pci_nvme_append_iov_req(struct pci_nvme_softc *sc, struct pci_nvme_ioreq *req,
- uint64_t gpaddr, size_t size, int do_write, uint64_t lba)
+ uint64_t gpaddr, size_t size, int do_write, uint64_t offset)
{
int iovidx;
+ bool range_is_contiguous;
if (req == NULL)
return (-1);
@@ -2179,8 +2180,17 @@
return (-1);
}
- /* concatenate contig block-iovs to minimize number of iovs */
- if ((req->prev_gpaddr + req->prev_size) == gpaddr) {
+ /*
+ * Minimize the number of IOVs by concatenating contiguous address
+ * ranges. If the IOV count is zero, there is no previous range to
+ * concatenate.
+ */
+ if (req->io_req.br_iovcnt == 0)
+ range_is_contiguous = false;
+ else
+ range_is_contiguous = (req->prev_gpaddr + req->prev_size) == gpaddr;
+
+ if (range_is_contiguous) {
iovidx = req->io_req.br_iovcnt - 1;
req->io_req.br_iov[iovidx].iov_base =
@@ -2194,7 +2204,7 @@
} else {
iovidx = req->io_req.br_iovcnt;
if (iovidx == 0) {
- req->io_req.br_offset = lba;
+ req->io_req.br_offset = offset;
req->io_req.br_resid = 0;
req->io_req.br_param = req;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 7, 6:53 PM (6 m, 12 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16515310
Default Alt Text
D35328.diff (1 KB)
Attached To
Mode
D35328: bhyve nvme: Fix out-of-bound IOV array access
Attached
Detach File
Event Timeline
Log In to Comment