From: mglocker Date: Wed, 10 Aug 2022 20:19:22 +0000 (+0000) Subject: Fix off-by-one in channel count, from NetBSD. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e866a596a3bd9b3ceffbad0321b1e31a381fec34;p=openbsd Fix off-by-one in channel count, from NetBSD. "Looks right" deraadt@ --- diff --git a/sys/dev/fdt/bcm2835_dmac.c b/sys/dev/fdt/bcm2835_dmac.c index 0149839cf04..ccf4f839c88 100644 --- a/sys/dev/fdt/bcm2835_dmac.c +++ b/sys/dev/fdt/bcm2835_dmac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcm2835_dmac.c,v 1.3 2022/06/28 16:29:03 anton Exp $ */ +/* $OpenBSD: bcm2835_dmac.c,v 1.4 2022/08/10 20:19:22 mglocker Exp $ */ /* * Copyright (c) 2020 Tobias Heider @@ -170,7 +170,7 @@ bcmdmac_attach(struct device *parent, struct device *self, void *aux) mtx_init(&sc->sc_lock, IPL_SCHED); - sc->sc_nchannels = 31 - __builtin_clz(sc->sc_channelmask); + sc->sc_nchannels = 32 - __builtin_clz(sc->sc_channelmask); sc->sc_channels = malloc(sizeof(*sc->sc_channels) * sc->sc_nchannels, M_DEVBUF, M_WAITOK);