[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1d9d4d78-073d-fc49-1918-f7c8ab6fe15e@suse.com>
Date: Tue, 25 Oct 2022 12:29:00 +0300
From: Nikolay Borisov <nborisov@...e.com>
To: Li zeming <zeming@...china.com>, clm@...com, josef@...icpanda.com,
dsterba@...e.com
Cc: linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: volumes: Increase bioc pointer check
On 25.10.22 г. 11:28 ч., Li zeming wrote:
> If kzalloc fails to allocate the bioc pointer, NULL is returned
> directly.
>
> Signed-off-by: Li zeming <zeming@...china.com>
This patch clearly shows you haven't really understood the code. As is
evident there is __GFP_NOFAIL flag so as per the guarantees for this
flag we either loop infinitely trying to allocate a bioc or simply
allocated it. So this check can never be triggered.
NAK
> ---
> 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);
Powered by blists - more mailing lists