Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8109944rwi; Tue, 25 Oct 2022 02:35:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5LnhMMytPnf54VgrsZJFCkwtbFVjhYysdW2vpG/AI3rppc7DwQ8bdZKbgwajXHlMLYMUgn X-Received: by 2002:a17:907:a072:b0:7ab:23e9:bc1 with SMTP id ia18-20020a170907a07200b007ab23e90bc1mr4554035ejc.72.1666690549811; Tue, 25 Oct 2022 02:35:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666690549; cv=none; d=google.com; s=arc-20160816; b=TTfpgWFUbGaXpxmUZVE5o61HexXsF4tIHkYOjtwZhx2yTHeYuJnn9TfDn8DxGJDsgu Uw2FV0LutKNcPDgJRaXRLXLkhAywnmxeQb7WtjTa+qSefeNsGGqoqCzYvKrM0z5EChlV uFsEEPnEBeuisNSpOX/T9QPaJv0fB2gQC5wNNViaa15lTpeHNcrAbCCkhNMAkFoocF+d OFe8d2BY/rU95bENHtmqQ/O5iem3sohQVuLwD8JuVK+7D3cXtzOxb7AApL+pnvflYXqz rfpzewcEbpDt6NBg08d3BCxPG4THjwsZB25n+rqRIit7XUDYIIHC1dI+PQxuyAkmEpKV rndg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=y67YZPae/MMAdDbSEoySCBhLfdwjFar8ncOEUvBtCTA=; b=sZA1fgVyIacFu/0OoEgjO4FN2k0Ht4nE4rzNb6x4x8SWKIY5JEf4v5o8pUSfbLXcqb vfXMWXcefL76WxjRLKVPY6mOxfTku/QHnFSjI55Uc9vsVsmx/miUPJ7IykpAfVH6BePO O5xnwzbBJZWmpgKQFKVS/+OlaBInl1jBubJEC1vUuAFZEfVoQDOAw8taI/DVqiJzKrE3 uvj4piBWFO3eHHddfrWz64xpz8omDuk7vURJj5S9F7ompDevKptoDKmt6UH2mcELR3TN iIQAtvbtYeu8cNpZ/ZOE4roK/BdEeKoqed7Rb9ckLYzLa/BIX0MfkpWqIRk49p3uMl9+ wdlQ== 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 hs41-20020a1709073ea900b0078e2f4c8851si1340252ejc.595.2022.10.25.02.35.22; Tue, 25 Oct 2022 02:35:48 -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 S232255AbiJYI2o (ORCPT + 99 others); Tue, 25 Oct 2022 04:28:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232199AbiJYI2m (ORCPT ); Tue, 25 Oct 2022 04:28:42 -0400 Received: from mail.nfschina.com (mail.nfschina.com [124.16.136.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 43EDAE984F; Tue, 25 Oct 2022 01:28:41 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id BA2AB1E80C8E; Tue, 25 Oct 2022 16:27:18 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (mail.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Uuw8E96Tt7r7; Tue, 25 Oct 2022 16:27:16 +0800 (CST) Received: from localhost.localdomain (unknown [219.141.250.2]) (Authenticated sender: zeming@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id 300B21E80C82; Tue, 25 Oct 2022 16:27:16 +0800 (CST) From: Li zeming To: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Li zeming Subject: [PATCH] btrfs: volumes: Increase bioc pointer check Date: Tue, 25 Oct 2022 16:28:35 +0800 Message-Id: <20221025082835.3751-1-zeming@nfschina.com> X-Mailer: git-send-email 2.18.2 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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 If kzalloc fails to allocate the bioc pointer, NULL is returned directly. Signed-off-by: Li zeming --- fs/btrfs/volumes.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 064ab2a79c80..f9cb815fe23d 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -5892,6 +5892,8 @@ static struct btrfs_io_context *alloc_btrfs_io_context(struct btrfs_fs_info *fs_ */ sizeof(u64) * (total_stripes), GFP_NOFS|__GFP_NOFAIL); + if (!bioc) + return NULL; atomic_set(&bioc->error, 0); refcount_set(&bioc->refs, 1); -- 2.18.2