Page MenuHomeFreeBSD
Paste P165

x86 MSI off by one
ActivePublic

Authored by jhb on Apr 11 2018, 10:31 PM.
Index: msi.c
===================================================================
--- msi.c (revision 332419)
+++ msi.c (working copy)
@@ -404,7 +404,7 @@
/* Do we need to create some new sources? */
if (cnt < count) {
/* If we would exceed the max, give up. */
- if (i + (count - cnt) > FIRST_MSI_INT + NUM_MSI_INTS) {
+ if (i + (count - cnt) >= FIRST_MSI_INT + NUM_MSI_INTS) {
mtx_unlock(&msi_lock);
free(mirqs, M_MSI);
return (ENXIO);
@@ -645,7 +645,7 @@
/* Do we need to create a new source? */
if (msi == NULL) {
/* If we would exceed the max, give up. */
- if (i + 1 > FIRST_MSI_INT + NUM_MSI_INTS) {
+ if (i + 1 >= FIRST_MSI_INT + NUM_MSI_INTS) {
mtx_unlock(&msi_lock);
return (ENXIO);
}

Event Timeline

jhb created this paste.Apr 11 2018, 10:31 PM
jhb created this object in space S1 Global.