On 2019/12/6 18:02, Guoqing Jiang wrote: > > > On 12/6/19 10:40 AM, liuzhiqiang (I) wrote: >> In raid1_sync_request func, rdev should be checked whether it is null >> before reference. > > Do you have real calltrace about it? Thanks for your comment. Actually, it is reported by one static scanning tool. > >> Fixes: 06f603851f("md/raid1: avoid reading known bad blocks during resync") >> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@xxxxxxxxxx> >> --- >> drivers/md/raid1.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c >> index a409ab6f30bc..0dea35052efe 100644 >> --- a/drivers/md/raid1.c >> +++ b/drivers/md/raid1.c >> @@ -2782,7 +2782,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, >> write_targets++; >> } >> } >> - if (bio->bi_end_io) { >> + if (rdev != NULL && bio->bi_end_io) { >> atomic_inc(&rdev->nr_pending); >> bio->bi_iter.bi_sector = sector_nr + rdev->data_offset; >> bio_set_dev(bio, rdev->bdev); > > If "bio->bi_end_io" is true, I think it implys rdev exists because bio->bi_end_io is set > when rdev != NUL. I don't object to add it to make it explicitly, but it is not a fix. > ok, i will remove the fixes tag in v2 patch. > Thanks, > Guoqing > > .