Date: Tue, 14 Jan 2020 02:14:03 +0000 (UTC) From: Ryan Libby <rlibby@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356716 - head/sys/kern Message-ID: <202001140214.00E2E3Ch098462@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001140214.00E2E3Ch098462>