Skip to content

Commit 09e5740

Browse files
committed
Merge branch 'md-next' of https://github.com/liu-song-6/linux into for-5.1/block
Pull MD changes for 5.1 from Song. * 'md-next' of https://github.com/liu-song-6/linux: raid1: simplify raid1_error function md-linear: use struct_size() in kzalloc()
2 parents e960f71 + ebda52f commit 09e5740

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

drivers/md/md-linear.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ static struct linear_conf *linear_conf(struct mddev *mddev, int raid_disks)
9696
int i, cnt;
9797
bool discard_supported = false;
9898

99-
conf = kzalloc (sizeof (*conf) + raid_disks*sizeof(struct dev_info),
100-
GFP_KERNEL);
99+
conf = kzalloc(struct_size(conf, disks, raid_disks), GFP_KERNEL);
101100
if (!conf)
102101
return NULL;
103102

drivers/md/raid1.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,11 +1603,9 @@ static void raid1_error(struct mddev *mddev, struct md_rdev *rdev)
16031603
return;
16041604
}
16051605
set_bit(Blocked, &rdev->flags);
1606-
if (test_and_clear_bit(In_sync, &rdev->flags)) {
1606+
if (test_and_clear_bit(In_sync, &rdev->flags))
16071607
mddev->degraded++;
1608-
set_bit(Faulty, &rdev->flags);
1609-
} else
1610-
set_bit(Faulty, &rdev->flags);
1608+
set_bit(Faulty, &rdev->flags);
16111609
spin_unlock_irqrestore(&conf->device_lock, flags);
16121610
/*
16131611
* if recovery is running, make sure it aborts.

0 commit comments

Comments
 (0)