[PATCH] block: Fix uninitialized symbol 'bio' in blk_rq_prep_clone
From: SurajSonawane2415
Date: Fri Oct 04 2024 - 06:09:12 EST
Fix the uninitialized symbol 'bio' in the function blk_rq_prep_clone
to resolve the following error:
block/blk-mq.c:3199 blk_rq_prep_clone() error: uninitialized symbol 'bio'.
Initialize 'bio' to NULL to prevent undefined behavior from uninitialized
access and safe cleanup in case of failure.
Signed-off-by: SurajSonawane2415 <surajsonawane0215@xxxxxxxxx>
---
block/blk-mq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4b2c8e940..b2087bdd9 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3156,7 +3156,7 @@ int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
int (*bio_ctr)(struct bio *, struct bio *, void *),
void *data)
{
- struct bio *bio, *bio_src;
+ struct bio *bio = NULL, *bio_src;
if (!bs)
bs = &fs_bio_set;
--
2.34.1