[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54d19fb4-f55f-64d9-10b9-2ece1147efaa@huaweicloud.com>
Date: Sat, 28 Dec 2024 14:11:24 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: Chaohai Chen <wdhh66@....com>, song@...nel.org
Cc: linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
"yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH] md: fix NULL point access
在 2024/12/28 10:15, Chaohai Chen 写道:
> bio_alloc_bioset may return NULL, we need to judge it before
> assign value to members of "new".
No, please read more about bio_alloc_bioset(), it doesn't return
NULL in this case.
Thanks,
Kuai
>
> Signed-off-by: Chaohai Chen <wdhh66@....com>
> ---
> drivers/md/md.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index aebe12b0ee27..a23419ad3dd8 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -585,6 +585,8 @@ bool md_flush_request(struct mddev *mddev, struct bio *bio)
> new = bio_alloc_bioset(rdev->bdev, 0,
> REQ_OP_WRITE | REQ_PREFLUSH, GFP_NOIO,
> &mddev->bio_set);
> + if (!new)
> + continue;
> new->bi_private = bio;
> new->bi_end_io = md_end_flush;
> bio_inc_remaining(bio);
>
Powered by blists - more mailing lists