From 6d14abdcc245478e552a68f46f222fe4f7d3c847 Mon Sep 17 00:00:00 2001 From: gnezdo Date: Fri, 23 Jun 2023 04:36:49 +0000 Subject: [PATCH] Avoid division by 0 in m_pool_used OK dlg@ Reported-by: syzbot+a377d5cd833c2343429a@syzkaller.appspotmail.com --- sys/kern/uipc_mbuf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 440a1ec5ecb..ba59f13a954 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.286 2023/05/16 20:09:27 mvs Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.287 2023/06/23 04:36:49 gnezdo Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -214,7 +214,7 @@ nmbclust_update(long newval) { int i; - if (newval < 0 || newval > LONG_MAX / MCLBYTES) + if (newval <= 0 || newval > LONG_MAX / MCLBYTES) return ERANGE; /* update the global mbuf memory limit */ nmbclust = newval; -- 2.20.1