Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8126969rwi; Tue, 25 Oct 2022 02:52:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5M9c75GEImTu63hyESLICE9+FRWCQbhja532+l61MSh2yRHE8ZYLqEgCOKODzGrpQg9IU5 X-Received: by 2002:a05:6402:414f:b0:456:c2c1:23ec with SMTP id x15-20020a056402414f00b00456c2c123ecmr35738618eda.420.1666691532147; Tue, 25 Oct 2022 02:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666691532; cv=none; d=google.com; s=arc-20160816; b=bnrFFjH7LycS8hpSLPLRgP4EzGubeGzh9QAVJCiurINQI+q4isYKpDXbezpv6G/l5O v3azrCtQI7JPYJgZKwb9mErGtGk+Nc7YHoNMP/Olv2m1Kdf1r8IqmcA94FQNVZ/NxqJh po3J4qKBANGhgcpFWkdsA3i/e0/Sz9zwSg7R7x6lpQgFJ2CvHp7Hhi/eSINUeYY7Kp3I ywQbwX8Sn5JA8ct5rM8DuLp//+xcWFp+G/DvSzos91KS4QtyJHVbFxFqRiqagXjOioX1 sfdoljbHeuFJZTLbYdn96GZJSdNB336pcF11ob15RYzC33GI1XfK48f6fQB4VITrzbRh N5ng== 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 :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=H3S+IQ088ZZxVDfr2CDBoL5KK+VYI/EZMCWPxFQFKOg=; b=hqmDwhClJrZyHI7VX0fnbaxiY2Ws5gabrLzts8oQ2WupPcNFOZfOy9lFMCfGhCerNF BL9N6mjaN69vDex4LMDJzYlIjCf5n92RDiK0TnyITzUgo9AHuPBLD8+V30U5UvZLYzU3 j3xIjX3x6OMbu/HpFA9KknLvZVqaqtC1WhKiepY7jaTrSXocC8P0+SXIvFl/5QiqY2kP LYZaLuxNeoTWM5VTmclLKR2Dh2TxCJE0lynTHFWv/Fet0TYDF07hTX0Uqx5tcHNFjCrU 722BP/xgFHJSKCUw1zWwxDKZc3fBe3dM9ccooC5/iil7IZqRDz0ZZk7yNZMrv6VbK1Kv SB2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=WTQgtmv6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u29-20020a50a41d000000b00461923a9257si2038033edb.174.2022.10.25.02.51.47; Tue, 25 Oct 2022 02:52:12 -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; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=WTQgtmv6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231981AbiJYJsf (ORCPT + 99 others); Tue, 25 Oct 2022 05:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231596AbiJYJsM (ORCPT ); Tue, 25 Oct 2022 05:48:12 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8F8A118764; Tue, 25 Oct 2022 02:48:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1666691280; bh=bIXLlB4wBooNLomsLfg/1mtVH+54a3pPal+Ht9C3bds=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=WTQgtmv6/GiistciZvEqeym+124StEMscUGKaQgTS7Ln5yZBXvb2rjfXukUROC79R DcFUB3pb7OoImxGVGo2OaShdgoAypl22PAgUgjgv8fcK5s6EQP4TY5/D8Ypn6wm1s8 dvN+pKuoZ+4QO3jNPA1S7E2QxwWnU/PbR2BXizLE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [0.0.0.0] ([149.28.201.231]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MnJlc-1pTzkh0ymK-00jGXQ; Tue, 25 Oct 2022 11:48:00 +0200 Message-ID: <9b98c931-0740-8bfc-f815-a06018ad5547@gmx.com> Date: Tue, 25 Oct 2022 17:47:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH] btrfs: volumes: Increase bioc pointer check To: Li zeming , clm@fb.com, josef@toxicpanda.com, dsterba@suse.com Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221025082835.3751-1-zeming@nfschina.com> Content-Language: en-US From: Qu Wenruo In-Reply-To: <20221025082835.3751-1-zeming@nfschina.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:GE6xPUqLgkODpcEcnn5tfOGCupCfr3W5gYY8HB25FMzL+FzuIHc x4C8DV3Ub49gVeyb7F66zU9XACQHe0UrjoVtG6cLcKmdz1SOzeKjcHVVIzRpiWohbWOfoY+ yUml/jD6lzWm3yxCYl23dc/W/d+bg0f3/eHxW5KZIYZAbRk3DjP0O8NR0X8b48Vad3/+f6z rDazoSo7YJtSdd/sYuuhw== X-UI-Out-Filterresults: notjunk:1;V03:K0:+W4Zlgk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QE5PdR1RVSl/IMuvExpfx7ph6ZfwvmKDKdygLf/wgp/TQLGpSZKiH3 4OPSO0yLGJ5lNH/ibYMMjlT+uRESyugGJ9jssTFIkRzWaPCANFr3vGdPu2vgaHYN0jVimDKij jRSqbCPS7AhG7qQHvpf5jK2dAoJLJ40AjnnKvWHimE1ROVMiK6d8+EeuE9Bh7VAZxBBu25NVR obsuQPD38FJduNgGD++PC5Mbegej/ISulX51Lub12STrHn5Ic55Oi1zhU3OLPggUQC9XOBsDR r6G46TAVJ6UJhvJdUzCHq7yumGhtqRkWyPJl8lXteDwzvT0AK7STQbusLOuvoBJ+YUAP+ZTBz IltBDwQYsVboqhCCWrPK6wmR5p7nRv0riz61lnY8nLEYE97ktvZOEUFpxEJvsAMiElFqpZIL6 M/4WKw7TRDxRYOGuPt93aF3TAEOu7ZZPoIJoU9IgAMZa0gSG3oLwl9mOGfgPtKK+7x7YD046r BljRY2J33Apk3UHKq4prkObHTujszRA1Tj3nFqsmRQ1Lc X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,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 2022/10/25 16:28, Li zeming wrote: > If kzalloc fails to allocate the bioc pointer, NULL is returned > directly. s/is returned/should be returned/ > > 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_con= text(struct btrfs_fs_info *fs_ > */ > sizeof(u64) * (total_stripes), > GFP_NOFS|__GFP_NOFAIL); I think you can also remove the __GFP_NOFAIL flag. Especially the only caller is properly handling the error. With that __GFP_NOFAIL flag there, it should not fail, but we can not just rely on NOFAIL flag to save our asses. Otherwise looks good to me. With above two points fixed, you can add my tag: Reviewed-by: Qu Wenruo Thanks, Qu > + if (!bioc) > + return NULL; > > atomic_set(&bioc->error, 0); > refcount_set(&bioc->refs, 1);