Skip to content

Commit 7397031

Browse files
Tetsuo Handaakpm00
Tetsuo Handa
authored andcommitted
nilfs2: initialize "struct nilfs_binfo_dat"->bi_pad field
nilfs_btree_assign_p() and nilfs_direct_assign_p() are not initializing "struct nilfs_binfo_dat"->bi_pad field, causing uninit-value reports when being passed to CRC function. Link: https://lkml.kernel.org/r/[email protected] Reported-by: syzbot <[email protected]> Link: https://syzkaller.appspot.com/bug?extid=048585f3f4227bb2b49b Reported-by: Dipanjan Das <[email protected]> Link: https://lkml.kernel.org/r/CANX2M5bVbzRi6zH3PTcNE_31TzerstOXUa9Bay4E6y6dX23_pg@mail.gmail.com Signed-off-by: Tetsuo Handa <[email protected]> Signed-off-by: Ryusuke Konishi <[email protected]> Cc: Alexander Potapenko <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 6be49d1 commit 7397031

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

fs/nilfs2/btree.c

+1
Original file line numberDiff line numberDiff line change
@@ -2219,6 +2219,7 @@ static int nilfs_btree_assign_p(struct nilfs_bmap *btree,
22192219
/* on-disk format */
22202220
binfo->bi_dat.bi_blkoff = cpu_to_le64(key);
22212221
binfo->bi_dat.bi_level = level;
2222+
memset(binfo->bi_dat.bi_pad, 0, sizeof(binfo->bi_dat.bi_pad));
22222223

22232224
return 0;
22242225
}

fs/nilfs2/direct.c

+1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ static int nilfs_direct_assign_p(struct nilfs_bmap *direct,
314314

315315
binfo->bi_dat.bi_blkoff = cpu_to_le64(key);
316316
binfo->bi_dat.bi_level = 0;
317+
memset(binfo->bi_dat.bi_pad, 0, sizeof(binfo->bi_dat.bi_pad));
317318

318319
return 0;
319320
}

0 commit comments

Comments
 (0)