Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8360359rwb; Wed, 23 Nov 2022 20:54:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf5NciYYbYNFhMQOeSGnpf6VsAMvyuTvDuuH4cfLH0V7mFB7ispr5rxHk/b0e1bYaZC0u3Y2 X-Received: by 2002:a17:907:2a56:b0:7ae:c2c:e55a with SMTP id fe22-20020a1709072a5600b007ae0c2ce55amr25684179ejc.214.1669265658407; Wed, 23 Nov 2022 20:54:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669265658; cv=none; d=google.com; s=arc-20160816; b=u+R+cwllSPiJe65nniGYsW2tFVXHo9XA9eYF/DIDXcT7Q2SvBIs/RM3S/Zd3iYK4uP 73cS3VhPHi23LIcOXtAW68pN/K680MdDy0V/BBDnnXvLZBmUgIZ/RaUCTFTLopo8g4ao 6GsD6eQ3XdD7UVRgL5VrDPlGsrsPQ7uDA4cAxsxRnsQt1SPNXz57QBEMxTxHkQIG3in7 yPH5M11lq5O+luGhiBMs+utNFlKHkIxTXs/Z/V4fb8Vh5IJ64p2V5PsRigk4A2bZRrt8 qM3XXeA2k1NeBk2W3EkksiwracUuv7dkQC5Z3vfzDg4f8QP7Vd1+0/mKRwP8P/SlcN+/ iqlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ZPXY+Il2iHbeOCONsaHDL0rxmOOGgxienNLy6p5TpaU=; b=n/KGlXdQIMlp0l3/bWU5rg1iNex9s91hzCg3+M45geB9DImaH61AW7wqDrcFnWIxpV EawtsapsLmv4asqEOSbQQMw31o3SG/iHJTLlLHc/DMWFvitti7HbZyd90VNq4TSIy1q0 JXKGs57zrOyIFJYcz0ksu0BNruNK/iiegw9xuhE0MXueSJDp9E30HRiuLleVv4EdrXuL K+Y+nvezsPGdrdMimKt+OWohLUILRBjwoBPObT55hs/UblPKBqhO1xM2/n8jvHuJDiW9 a7S5fqoXxHyWT/M5BJSpeGKZaZKUYjcnMyePjIk94fThbVzKp9lWr8aq22Qgykc5i+Y4 k80A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=f12NgdMo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb31-20020a1709077e9f00b007adb3888ad9si20228ejc.351.2022.11.23.20.53.57; Wed, 23 Nov 2022 20:54:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=f12NgdMo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229697AbiKXEZt (ORCPT + 88 others); Wed, 23 Nov 2022 23:25:49 -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 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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.