[Drbd-dev] [PATCH 09/14] dm: add a missing bio initialization to alloc_tio

Christoph Hellwig hch at lst.de
Thu Jan 27 07:35:41 CET 2022


The bio in the tio embedded into the clone_info structure is never
initialized.  This is harmless as bio_init only zeroes the structure
and assigns the vectors, but add the initialization to prepare for
refactoring the bio cloning logic.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/md/dm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index ee2d92ec7c9fc..57f44d3a4d747 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -552,6 +552,7 @@ static struct bio *alloc_tio(struct clone_info *ci, struct dm_target *ti,
 	if (!ci->io->tio.io) {
 		/* the dm_target_io embedded in ci->io is available */
 		tio = &ci->io->tio;
+		bio_init(&tio->clone, NULL, NULL, 0, 0);
 	} else {
 		struct bio *clone = bio_alloc_bioset(NULL, 0, 0, gfp_mask,
 						     &ci->io->md->bs);
-- 
2.30.2



More information about the drbd-dev mailing list