From: dlg Date: Tue, 13 Jun 2017 11:41:11 +0000 (+0000) Subject: when enabling cpu caches, check the item size against the right thing X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2b9bbc5594dd7f84398492810704620a2a8ea0d5;p=openbsd when enabling cpu caches, check the item size against the right thing lists of free items on the per cpu caches are built out the pool items as struct pool_cache_items, not struct pool_cache. make the KASSERT in pool_cache_init check that properly. --- diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c index ec6b290ee8b..1da3c627399 100644 --- a/sys/kern/subr_pool.c +++ b/sys/kern/subr_pool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_pool.c,v 1.208 2017/04/20 14:13:00 visa Exp $ */ +/* $OpenBSD: subr_pool.c,v 1.209 2017/06/13 11:41:11 dlg Exp $ */ /* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */ /*- @@ -1608,7 +1608,8 @@ pool_cache_init(struct pool *pp) IPL_NONE, PR_WAITOK, "plcache", NULL); } - KASSERT(pp->pr_size >= sizeof(*pc)); + /* must be able to use the pool items as cache list items */ + KASSERT(pp->pr_size >= sizeof(struct pool_cache_item)); cm = cpumem_get(&pool_caches);