From patchwork Sun Oct 30 07:35:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 12949 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1683231wru; Sun, 30 Oct 2022 00:37:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4MdMup6zWxaZ2LVRdaBLmXJlOoT8IzMXeqySARIaVtiEQPmWid47o5z2jLXmQKAqgotPt3 X-Received: by 2002:a17:906:5dcc:b0:78d:e77d:e66f with SMTP id p12-20020a1709065dcc00b0078de77de66fmr6928147ejv.102.1667115443918; Sun, 30 Oct 2022 00:37:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667115443; cv=none; d=google.com; s=arc-20160816; b=h3ufV5g6Vfz7OWjTFcC9AbuVnwscqtOP8DqaaAhMAjuSF9XNr3FbStfZ6COPAVM0vs lxWmkCQmyPfFkbIgrKu6UbY618bQpXUZy5nz1zMaL28rCYgpOmNxUvZpPAKfHkBKwBm6 YpTz21S4paqzXgDIope0/pa48j36nA1m3ALy/iCvuFcbhz47MU/7nNutftW0WWPhJzC+ tjU8XBIspLAw9365IiaqhC9GoKUXschuTUJm2b/5jtiFej3FJZAUjG9VivnrpX4m8q3s Kkkh5/RAgM3Vau73nRt0rzOwe0+JbYn3yC7sHMPDRggyVDN+jKVahVW+JeFq913RBuEb yC2Q== 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=PkEA5qfR7VMz0IV2jFoiHyOfahhWjtYNuB4FewVHG5A=; b=w6gHqiRfexN3kS/f2Hl1ba9Fa4zcN2NmQfpanl1bVAiVng1Yc2QEtw4vnhoquWKRuj TKTEoa3FaHSxn3FwAhtLu0zOF7MvqlGgP1Sm0cMRS2d2A+rWqw0KqhpfXa/mvhUdjJ5o HgZJQfyZyIcOs+wHmVQvOvODl/tb273V1f8Imh5qvAldFmpePZCL2J2hUqBRHnVDpgYa /CSTf/GjvrVXfFb/haUqk0ujBgNheA/lAzigqwSCM8m4JfMMBKgTTUNHKOqNM9DnHKxt BNSad1rfj7qm6DQEI6VZ62xlNFTKQ0g0GZMQJFcKAH4HZYCqg0RbWMY5t62tQouoK5XR 9qzQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd38-20020a17090762a600b007882936243fsi3190524ejc.772.2022.10.30.00.37.00; Sun, 30 Oct 2022 00:37:23 -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 S229588AbiJ3HgH (ORCPT + 99 others); Sun, 30 Oct 2022 03:36:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbiJ3HgA (ORCPT ); Sun, 30 Oct 2022 03:36:00 -0400 Received: from smtp.smtpout.orange.fr (smtp-15.smtpout.orange.fr [80.12.242.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41BB9D48 for ; Sun, 30 Oct 2022 00:35:34 -0700 (PDT) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id p2qvo95G2PMmap2qvoyNMf; Sun, 30 Oct 2022 08:35:30 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 30 Oct 2022 08:35:30 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Chris Mason , Josef Bacik , David Sterba , Nikolay Borisov Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs: Fix a memory allocation failure test Date: Sun, 30 Oct 2022 08:35:28 +0100 Message-Id: <34dff6b621770b1f8078ce6c715b61c5908e1ad1.1667115312.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748097243838915755?= X-GMAIL-MSGID: =?utf-8?q?1748097243838915755?= 'dip' is tested instead of 'dip->csums'. Fix it. Fixes: 642c5d34da53 ("btrfs: allocate the btrfs_dio_private as part of the iomap dio bio") Signed-off-by: Christophe JAILLET Reviewed-by: Nikolay Borisov --- fs/btrfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 966cc050cdbb..3bbd2dc6282f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8078,7 +8078,7 @@ static void btrfs_submit_direct(const struct iomap_iter *iter, */ status = BLK_STS_RESOURCE; dip->csums = kcalloc(nr_sectors, fs_info->csum_size, GFP_NOFS); - if (!dip) + if (!dip->csums) goto out_err; status = btrfs_lookup_bio_sums(inode, dio_bio, dip->csums);