From owner-svn-src-all@freebsd.org Tue Jan 14 02:14:03 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 980EB1F607B; Tue, 14 Jan 2020 02:14:03 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47xYt33Xtrz4Sw8; Tue, 14 Jan 2020 02:14:03 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74ABBE664; Tue, 14 Jan 2020 02:14:03 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00E2E3GT098464; Tue, 14 Jan 2020 02:14:03 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00E2E3Ch098462; Tue, 14 Jan 2020 02:14:03 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <202001140214.00E2E3Ch098462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Tue, 14 Jan 2020 02:14:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356716 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 356716 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2020 02:14:03 -0000 Author: rlibby Date: Tue Jan 14 02:14:02 2020 New Revision: 356716 URL: https://svnweb.freebsd.org/changeset/base/356716 Log: malloc: remove assumptions about MINALLOCSIZE Remove assumptions about the minimum MINALLOCSIZE, in order to allow testing of smaller MINALLOCSIZE. A following patch will lower the MINALLOCSIZE, but not so much that the present patch is required for correctness at these sites. Reviewed by: jeff, markj Sponsored by: Dell EMC Isilon Modified: head/sys/kern/kern_prot.c head/sys/kern/subr_bus.c Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Tue Jan 14 02:13:46 2020 (r356715) +++ head/sys/kern/kern_prot.c Tue Jan 14 02:14:02 2020 (r356716) @@ -2054,7 +2054,7 @@ crextend(struct ucred *cr, int n) */ if ( n < PAGE_SIZE / sizeof(gid_t) ) { if (cr->cr_agroups == 0) - cnt = MINALLOCSIZE / sizeof(gid_t); + cnt = MAX(1, MINALLOCSIZE / sizeof(gid_t)); else cnt = cr->cr_agroups * 2; Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Tue Jan 14 02:13:46 2020 (r356715) +++ head/sys/kern/subr_bus.c Tue Jan 14 02:14:02 2020 (r356716) @@ -1686,7 +1686,8 @@ devclass_alloc_unit(devclass_t dc, device_t dev, int * int newsize; oldlist = dc->devices; - newsize = roundup((unit + 1), MINALLOCSIZE / sizeof(device_t)); + newsize = roundup((unit + 1), + MAX(1, MINALLOCSIZE / sizeof(device_t))); newlist = malloc(sizeof(device_t) * newsize, M_BUS, M_NOWAIT); if (!newlist) return (ENOMEM);