Skip to content

Commit df203da

Browse files
ncroxonliu-song-6
authored andcommitted
md/raid1: fix error: ISO C90 forbids mixed declarations
There is a compile error when this commit is added: md: raid1: fix potential OOB in raid1_remove_disk() drivers/md/raid1.c: In function 'raid1_remove_disk': drivers/md/raid1.c:1844:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 1844 |         struct raid1_info *p = conf->mirrors + number;     |         ^~~~~~ That's because the new code was inserted before the struct. The change is move the struct command above this commit. Fixes: 8b0472b ("md: raid1: fix potential OOB in raid1_remove_disk()") Signed-off-by: Nigel Croxon <ncroxon@redhat.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/46d929d0-2aab-4cf2-b2bf-338963e8ba5a@redhat.com
1 parent 9989214 commit df203da

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/md/raid1.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,12 +1837,11 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
18371837
struct r1conf *conf = mddev->private;
18381838
int err = 0;
18391839
int number = rdev->raid_disk;
1840+
struct raid1_info *p = conf->mirrors + number;
18401841

18411842
if (unlikely(number >= conf->raid_disks))
18421843
goto abort;
18431844

1844-
struct raid1_info *p = conf->mirrors + number;
1845-
18461845
if (rdev != p->rdev)
18471846
p = conf->mirrors + conf->raid_disks + number;
18481847

0 commit comments

Comments
 (0)