There's only two disk elevator disciplines 0 - fifo and 1 - nscan.
BUFQ_HOWMANY is 2, but the 'type' should be checked against
(BUFQ_HOWMANY - 1) as it's used as an index.

OK?

diff --git sys/kern/kern_bufq.c sys/kern/kern_bufq.c
index 7ed83470e58..ad9558e0d53 100644
--- sys/kern/kern_bufq.c
+++ sys/kern/kern_bufq.c
@@ -76,11 +76,11 @@ const struct bufq_impl bufq_impls[BUFQ_HOWMANY] = {
 int
 bufq_init(struct bufq *bq, int type)
 {
        u_int hi = BUFQ_HI, low = BUFQ_LOW;
 
-       if (type > BUFQ_HOWMANY)
+       if (type >= BUFQ_HOWMANY)
                panic("bufq_init: type %i unknown", type);
 
        /*
         * Ensure that writes can't consume the entire amount of kva
         * available the buffer cache if we only have a limited amount

Reply via email to