From 3210cc957a73665be89d6ac36e86f5813af62fa3 Mon Sep 17 00:00:00 2001 From: miod Date: Wed, 28 Feb 2024 12:53:31 +0000 Subject: [PATCH] Fix rx_bufs accounting buglet; reported on bugs@ by dns at strangeloop dot cc; ok claudio@ deraadt@ --- sys/dev/ic/fxp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c index d2001c0b679..02097de9e60 100644 --- a/sys/dev/ic/fxp.c +++ b/sys/dev/ic/fxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fxp.c,v 1.133 2023/11/10 15:51:20 bluhm Exp $ */ +/* $OpenBSD: fxp.c,v 1.134 2024/02/28 12:53:31 miod Exp $ */ /* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */ /* @@ -1382,11 +1382,12 @@ fxp_init(void *xsc) else bufs = FXP_NRFABUFS_MIN; if (sc->rx_bufs > bufs) { - while (sc->rfa_headm != NULL && sc->rx_bufs-- > bufs) { + while (sc->rfa_headm != NULL && sc->rx_bufs > bufs) { rxmap = *((bus_dmamap_t *)sc->rfa_headm->m_ext.ext_buf); bus_dmamap_unload(sc->sc_dmat, rxmap); FXP_RXMAP_PUT(sc, rxmap); sc->rfa_headm = m_free(sc->rfa_headm); + sc->rx_bufs--; } } else if (sc->rx_bufs < bufs) { int err, tmp_rx_bufs = sc->rx_bufs; -- 2.20.1