Commit 1f98d9bc authored by Nigel Croxon's avatar Nigel Croxon Committed by sanglipeng
Browse files

md/raid1: fix error: ISO C90 forbids mixed declarations

stable inclusion
from stable-v5.10.197
commit 634444dea898914d9741f30fc4e4161fdd689a58
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I96Q8P

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=634444dea898914d9741f30fc4e4161fdd689a58



--------------------------------

[ Upstream commit df203da4 ]

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: 8b0472b5 ("md: raid1: fix potential OOB in raid1_remove_disk()")
Signed-off-by: default avatarNigel Croxon <ncroxon@redhat.com>
Signed-off-by: default avatarSong Liu <song@kernel.org>
Link: https://lore.kernel.org/r/46d929d0-2aab-4cf2-b2bf-338963e8ba5a@redhat.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent c1a09f19
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment