On my desktop with 8 programmable counters, calling `pmcstat` with 9 separate events will panic the system. With this patch, it will fail to allocate the 9th, it will fail to allocate the 9thas expected.
See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253687#c16