Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109271868
D36829.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
D36829.diff
View Options
diff --git a/usr.sbin/bhyve/pci_xhci.c b/usr.sbin/bhyve/pci_xhci.c
--- a/usr.sbin/bhyve/pci_xhci.c
+++ b/usr.sbin/bhyve/pci_xhci.c
@@ -290,10 +290,10 @@
};
-/* portregs and devices arrays are set up to start from idx=1 */
-#define XHCI_PORTREG_PTR(x,n) &(x)->portregs[(n)]
-#define XHCI_DEVINST_PTR(x,n) (x)->devices[(n)]
-#define XHCI_SLOTDEV_PTR(x,n) (x)->slots[(n)]
+/* port and slot numbering start from 1 */
+#define XHCI_PORTREG_PTR(x,n) &((x)->portregs[(n) - 1])
+#define XHCI_DEVINST_PTR(x,n) ((x)->devices[(n) - 1])
+#define XHCI_SLOTDEV_PTR(x,n) ((x)->slots[(n) - 1])
#define XHCI_HALTED(sc) ((sc)->opregs.usbsts & XHCI_STS_HCH)
@@ -2738,10 +2738,6 @@
sc->devices = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_dev_emu *));
sc->slots = calloc(XHCI_MAX_SLOTS, sizeof(struct pci_xhci_dev_emu *));
- /* port and slot numbering start from 1 */
- sc->devices--;
- sc->slots--;
-
ndevices = 0;
slots_nvl = find_relative_config_node(nvl, "slot");
@@ -2835,7 +2831,6 @@
portsfinal:
sc->portregs = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_portregs));
- sc->portregs--;
if (ndevices > 0) {
for (i = 1; i <= XHCI_MAX_DEVS; i++) {
@@ -2851,8 +2846,8 @@
free(XHCI_DEVINST_PTR(sc, i));
}
- free(sc->devices + 1);
- free(sc->slots + 1);
+ free(sc->devices);
+ free(sc->slots);
return (-1);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 3, 9:14 PM (21 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16442675
Default Alt Text
D36829.diff (1 KB)
Attached To
Mode
D36829: bhyve: Avoid triggering false -Wfree-nonheap-object warnings.
Attached
Detach File
Event Timeline
Log In to Comment