Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6223396rwb; Tue, 22 Nov 2022 10:17:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf5CldvDaB2m/2yLlPfAtnqlt7IJV5e9exvUy8styfGl3XRz99VSmEQV0IhrIiBArDHswQ6n X-Received: by 2002:a65:6d10:0:b0:476:fdde:e539 with SMTP id bf16-20020a656d10000000b00476fddee539mr7326250pgb.216.1669141069244; Tue, 22 Nov 2022 10:17:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669141069; cv=none; d=google.com; s=arc-20160816; b=SWo5OrJY8lxJzIYAWWyY0iyYwx4a/ydiy/5vQDRMXFRp1f6dNTs5peEWb+qOjAANFy ZuDViswoQlmStk/5gyBNNykhfdnPtFvyDZ/liBoDCrtvram7GxS83qPhOVuUDBYAg85h fO3m6p22MMGepLpV40RTjlvmWxKKgFIBJWjQ4vok83Bf0K/vOCfnUjpDNylVfrZDfZkK cJIcj2afM4neNpEygumr3KUf0VijDLVnVHO4AFbpyo0gHtP1US1Q8qjV0lCFmy/HMy2j v9F7jRPd/EsILILqMXxlBajBshiqQXCMACCO0LYxSOKlEkV0RcJoiOh3PXJyi87kDDU5 EYBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=zdsumaP7cDUo4Et8927xbmhxZSyPNVluIffHpo0DDv8=; b=h4RIPB+DFoS3s4yZHS6bhG8yFxev1OdkGkDgJxHBsHeU1m5HZt8pf5HOJBT0pi+jjf m1o454lXuBOdvAzA+GCgjARtqY2Sn7Ye/nFKnkmsmC/sTkZkbcG5Ul2hHYizkByu3Oag 2V0hYGBrv7naXJ2reFRufjInSCcwN0lHFs82dhSsirGhOupRXrK8S148wVsofEWx1xk8 FyGgl4OOQxPQoKyBpd1M3QGFrJa1hkTnmkSBOeNHE8S9SwvPh3hDzjAmkfT0rBMccGFW Y6W7NzF/avsdpuPTsX6vjwvc+FR0gH5CB/kmR8043Xk7e0LxyZBGJVL3ToAn0GmgmE4s hIrA== ARC-Authentication-Results: i=1; mx.google.com; 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 y18-20020a17090322d200b00186b45948d1si16660043plg.125.2022.11.22.10.17.37; Tue, 22 Nov 2022 10:17:49 -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; 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 S234426AbiKVSHV (ORCPT + 90 others); Tue, 22 Nov 2022 13:07:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232800AbiKVSHR (ORCPT ); Tue, 22 Nov 2022 13:07:17 -0500 Received: from smtp.smtpout.orange.fr (smtp-12.smtpout.orange.fr [80.12.242.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D679170A2E for ; Tue, 22 Nov 2022 10:07:15 -0800 (PST) Received: from [192.168.1.18] ([86.243.100.34]) by smtp.orange.fr with ESMTPA id xXfroj0BLM75kxXfroW5jJ; Tue, 22 Nov 2022 19:07:14 +0100 X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 22 Nov 2022 19:07:14 +0100 X-ME-IP: 86.243.100.34 Message-ID: <68d4ef1d-ce51-133f-3974-613da458ea40@wanadoo.fr> Date: Tue, 22 Nov 2022 19:07:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH] libnvdimm: Add check for nd_dax_alloc Content-Language: fr To: Jiasheng Jiang , dan.j.williams@intel.com, vishal.l.verma@intel.com, dave.jiang@intel.com, ira.weiny@intel.com Cc: nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org References: <20221122023350.29128-1-jiasheng@iscas.ac.cn> From: Christophe JAILLET In-Reply-To: <20221122023350.29128-1-jiasheng@iscas.ac.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 Le 22/11/2022 à 03:33, Jiasheng Jiang a écrit : > As the nd_dax_alloc may return NULL pointer, > it should be better to add check for the return > value, as same as the one in nd_dax_create(). > > Fixes: c5ed9268643c ("libnvdimm, dax: autodetect support") > Signed-off-by: Jiasheng Jiang > --- > drivers/nvdimm/dax_devs.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/nvdimm/dax_devs.c b/drivers/nvdimm/dax_devs.c > index 7f4a9d28b670..9efe62b95dd8 100644 > --- a/drivers/nvdimm/dax_devs.c > +++ b/drivers/nvdimm/dax_devs.c > @@ -106,6 +106,8 @@ int nd_dax_probe(struct device *dev, struct nd_namespace_common *ndns) > > nvdimm_bus_lock(&ndns->dev); > nd_dax = nd_dax_alloc(nd_region); > + if (!nd_dax) > + return -ENOMEM; > nd_pfn = &nd_dax->nd_pfn; > dax_dev = nd_pfn_devinit(nd_pfn, ndns); > nvdimm_bus_unlock(&ndns->dev); Hi, Based on 6.1-rc6 ([1]), the error handling is already in place just after the nvdimm_bus_unlock() call. CJ [1]: https://elixir.bootlin.com/linux/v6.1-rc6/source/drivers/nvdimm/dax_devs.c#L112