From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2123C4332F for ; Thu, 24 Nov 2022 04:25:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbiKXEZv (ORCPT ); Wed, 23 Nov 2022 23:25:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbiKXEZn (ORCPT ); Wed, 23 Nov 2022 23:25:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E766C9ABD for ; Wed, 23 Nov 2022 20:25:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BFDBAB826C9 for ; Thu, 24 Nov 2022 04:25:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60DC5C433C1; Thu, 24 Nov 2022 04:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1669263938; bh=vOnl+PAW/vecWK18KoII+NqVjfMzySB3kHa1v947VSI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=f12NgdMoqauyCN2r9JRF0Ir96lgqOqdfJ7CMAfTzO+fTRgdOTXCfPeN32qIu+0POw bWUOzS5b0oHKt1lrqcF84EKQbrYA8bClwjGgAFpZVTTGzgKlXO8pXTU1Of9zYc5+Io WARqe5d/TFWiuX7HqxX2DfYExit7SNCneSzGJJhI= Date: Wed, 23 Nov 2022 20:25:37 -0800 From: Andrew Morton To: Jiasheng Jiang Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/vmalloc: Add check for KMEM_CACHE Message-Id: <20221123202537.3378bf960c01f9773f6a4675@linux-foundation.org> In-Reply-To: <20221124040226.17953-1-jiasheng@iscas.ac.cn> References: <20221124040226.17953-1-jiasheng@iscas.ac.cn> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Nov 2022 12:02:26 +0800 Jiasheng Jiang 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.