Date: Fri, 9 Jul 2021 15:54:25 -0400 From: Shawn Webb <shawn.webb@hardenedbsd.org> To: Warner Losh <imp@FreeBSD.org> Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 72821668b039 - main - stand/kmem_zalloc: panic when a M_WAITOK allocation fails Message-ID: <20210709195425.xzk2azaor4ielmb4@mutt-hbsd> In-Reply-To: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> References: <202107091726.169HQvGQ084473@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--bbnarx7wbuksohxs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 09, 2021 at 05:26:57PM +0000, Warner Losh wrote: > The branch main has been updated by imp: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D72821668b039c276914569e9ca= a1cdfa4e4cb674 >=20 > commit 72821668b039c276914569e9caa1cdfa4e4cb674 > Author: Warner Losh <imp@FreeBSD.org> > AuthorDate: 2021-07-09 17:21:18 +0000 > Commit: Warner Losh <imp@FreeBSD.org> > CommitDate: 2021-07-09 17:21:18 +0000 >=20 > stand/kmem_zalloc: panic when a M_WAITOK allocation fails > =20 > Malloc() might return NULL, in which case we will panic with a NULL > pointer deref. Make it panic when the allocation fails to preserve the > postcondtion that we never return a non-NULL value. malloc(9) tells us that M_WAITOK will never fail. I'm thinking this conditional might need to be negated for the !M_WAITOK case, in which malloc(9) could indeed fail. Although, even as I type this email, I just realized that a different function, Malloc, is being called. What's the difference between malloc and Malloc? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --bbnarx7wbuksohxs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmDoqXEACgkQ/y5nonf4 4fpiPQ/9GhtOSJy3+Stl9jkeS3ZoT03rPiQouKWNEyS3PqbPJ9LYN2xT66FVDViJ ZYQ/fjH27lDikBOExbvO70ykU5D9HBgjmvqkrG8sQKbCwJzGE9gy4l0uNTdA4Lm7 fOic36syucTSeKwvWq7ptYMyz75/fSxovIoyH9uPB4oL6bZzjjuhYk1Z3XnglVG8 MJhqvpzz77ORjiuymB1QbZSq7a1F79jPcRMC0cK6xm4BmLPn+Brw/+eviQ4vr160 0L9ZfR/NA0XUgC9tDwfDgGjYQVRsZ3Xl8B8M9UXybbPHQMRyunWupfU4+Gln2AVH X6Rt6aeuvBA46gBp+/ea8NatGDWYZLPAfGNe54oS8LGj3Db1e2LayEyLDSguTzWL AgY1p0fnNdF4YAfY8HIoTmP7PvYwFjUNpL4MXAjeotWWMKoaIXtbWBFfYmxmfbZx ep2/S8jenXYK0SmG5ky9+P5YJCNdKpeg5/b5LsApOoegme6LFTd2uAN1Dg33ipvH VfxX7B35dqlFqR6gGBUJm3MzOJF1kR7L5cZR/BWHIJ1Y9ZPzZ0xeaZ8OJrKjhQOm QoATgJ2ouHUxXO1vLETJxRiwoKfzOxaMOitbXblU014bAr3YojzZ7KCj0ipFvdn/ t4y+Q2dsEMcZtRKvv94vdcCgx/QUcFJoFksELQisLfs4vd9/QpY= =NObg -----END PGP SIGNATURE----- --bbnarx7wbuksohxs--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210709195425.xzk2azaor4ielmb4>