Re: [PATCH] md: fix NULL point access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



在 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@xxxxxxx>
---
  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);






[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux