PPC: Add KASSERT in intrcnt_add which checks for buffer overflow

Authored by:           Patryk Duda <pdk@semihalf.com>
Submitted by:          Wojciech Macek <wma@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies
This commit is contained in:
Wojciech Macek 2018-01-24 12:01:32 +00:00
parent 6fb1399a4c
commit 68c2d255bc

View File

@ -178,6 +178,8 @@ intrcnt_add(const char *name, u_long **countp)
int idx;
idx = atomic_fetchadd_int(&intrcnt_index, 1);
KASSERT(idx < INTR_VECTORS, ("intrcnt_add: Interrupt counter index "
"reached INTR_VECTORS"));
*countp = &intrcnt[idx];
intrcnt_setname(name, idx);
}