Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1217705pxb; Fri, 1 Apr 2022 07:39:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0AJhjkwfTVozNMo4pwUy6bl9ibGylOqfiYuv7hVdZ1yGuwI+z0RnDxk9Xxjilq9PSi4BH X-Received: by 2002:a17:907:c018:b0:6df:e7d8:3397 with SMTP id ss24-20020a170907c01800b006dfe7d83397mr99392ejc.143.1648823977780; Fri, 01 Apr 2022 07:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648823977; cv=none; d=google.com; s=arc-20160816; b=Kym34n6G8XvTsWAC+XsAPRHgAJ/MUWS6KwgMasPXTz5KE267Wv40b5EZAu5v2Iqns7 OU0AP44dTYnsIQqN1lQ6tfxT9Y5xV0bB8r5UOQ4RR0xnNf6lXZShOld/L4sZ3qhQm7E7 cTnU1MbtQvvFqJql0WuYGLhrMt/a0/r3ZSdwhxspKW3hez0E7Qpy25klTz7lwHbq00IG tYE/PuSIUQEtZFpaUTg6sq3wxlOUj+SlQnhpQTm5h2oEZiydKq4NeG48DG9FLe+3QtSL rh9RL6QoRjfthRQ+6YjUOt4mXknIxQRywvNxnV2I1vvaxmcDz3BEuEyjAmnl2IN9zFpu 73Yg== 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 :message-id:date:subject:cc:to:from; bh=431iKyuoE2YGLjyWuoseQ3lXW7ft8gA6rh9dMYV8vUw=; b=fM9ubgBVpJjJGakuGgCAFrK1pCSsfkj3xPW8ADIkTX/6S+W85Bb7moYAZCOZ0RtK7g ZhiY8h8gbkTOfDnRXGdH7lDm4Axf/RSLrfJZGSZjuuid49uu/TTYLjWYqA2pNeW0kr3i 9og0I5p4dIw1REVcI/Fy4QK7zVpBd3MFwEUfW78DvF+mhlqUOTXdp0fIZZSiMXHSnyU9 dEswNXIk60OBzdudq2krLnvpgFdMevwkjMPJVfqmp8hgMwusNOogbhteH6etlnqwXvQO P1cGHyuKwAckaNhvs49WyoyYhKJ+L1Lq5Gevc9dPdOoHluxu08/L9bpQAwgO891R8+rC l9UQ== 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 s17-20020a1709067b9100b006e02924245csi1614422ejo.714.2022.04.01.07.39.11; Fri, 01 Apr 2022 07:39:37 -0700 (PDT) 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 S244652AbiDADj6 (ORCPT + 99 others); Thu, 31 Mar 2022 23:39:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241470AbiDADj5 (ORCPT ); Thu, 31 Mar 2022 23:39:57 -0400 Received: from cstnet.cn (smtp25.cstnet.cn [159.226.251.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 321A923F3A6 for ; Thu, 31 Mar 2022 20:38:06 -0700 (PDT) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-05 (Coremail) with SMTP id zQCowABnSQaVc0Ziz_T6AA--.41623S2; Fri, 01 Apr 2022 11:37:58 +0800 (CST) From: Jiasheng Jiang To: hch@infradead.org Cc: rpeterso@redhat.com, agruenba@redhat.com, cluster-devel@redhat.com, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: Re: [Cluster-devel] [PATCH] gfs2: Add check for mempool_alloc Date: Fri, 1 Apr 2022 11:37:55 +0800 Message-Id: <20220401033755.1892644-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: zQCowABnSQaVc0Ziz_T6AA--.41623S2 X-Coremail-Antispam: 1UD129KBjvdXoWrGr4xXr1UXrW3CFyxZF17trb_yoWxWFX_WF Z7Cr4DA3yvkFn7tan0yr15urn5Kw45WF4xXry5Arnaq3s5Xa47Xw1DW3yrZrs7WrZ0qrnx uF9IkaySvrya9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbzxFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxVWxJr 0_GcWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1l42xK82IYc2Ij64vI r41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8Gjc xK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0 cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8V AvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7Cj xVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7VUbrMaUUUUUU== X-Originating-IP: [124.16.138.126] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Wed, 30 Mar 2022 11:56:41 +0800 Christoph Hellwig wrote: >> As the potential failure of mempool_alloc(), >> it could return NULL pointer. >> Therefore, it should be better to check it >> in order to avoid the dereference of the NULL >> pointer. >> >> Fixes: e8c92ed76900 ("GFS2: Clean up log write code path") >> Signed-off-by: Jiasheng Jiang > > Please explain how it could fail to start with. I think that for safety, the cost of redundant and harmless check is acceptable. Also, checking after allocation is a good program pattern. Therefore, it should be better to check it although it is hard to fail. Thanks, Jiang