Re: [PATCH] mm/vmalloc: Add check for KMEM_CACHE

From: Andrew Morton
Date: Wed Nov 23 2022 - 23:25:55 EST


On Thu, 24 Nov 2022 12:02:26 +0800 Jiasheng Jiang <jiasheng@xxxxxxxxxxx> wrote:

> As KMEM_CACHE may return NULL pointer, it should
> be better to check the return value in order to
> avoid NULL pointer dereference in kmem_cache_zalloc.
>
> ...
>
> @@ -2426,15 +2426,17 @@ void __init vmalloc_init(void)

Linux assumes that allocation attempts from __init code will succeed.

Because if they fail so early in the boot process, the system is so
utterly messed up that we may as well just go oops.