]>
Commit | Line | Data |
---|---|---|
de78ab3b SL |
1 | From 8c7453632eac75cb83a55878d5034d1dd3fe8c71 Mon Sep 17 00:00:00 2001 |
2 | From: Mark Rutland <mark.rutland@arm.com> | |
3 | Date: Mon, 25 Jan 2016 11:44:55 +0000 | |
4 | Subject: asm-generic: Fix local variable shadow in __set_fixmap_offset | |
5 | ||
6 | [ Upstream commit 3694bd76781b76c4f8d2ecd85018feeb1609f0e5 ] | |
7 | ||
8 | Currently __set_fixmap_offset is a macro function which has a local | |
9 | variable called 'addr'. If a caller passes a 'phys' parameter which is | |
10 | derived from a variable also called 'addr', the local variable will | |
11 | shadow this, and the compiler will complain about the use of an | |
12 | uninitialized variable. To avoid the issue with namespace clashes, | |
13 | 'addr' is prefixed with a liberal sprinkling of underscores. | |
14 | ||
15 | Turning __set_fixmap_offset into a static inline breaks the build for | |
16 | several architectures. Fixing this properly requires updates to a number | |
17 | of architectures to make them agree on the prototype of __set_fixmap (it | |
18 | could be done as a subsequent patch series). | |
19 | ||
20 | Signed-off-by: Mark Rutland <mark.rutland@arm.com> | |
21 | Cc: Arnd Bergmann <arnd@arndb.de> | |
22 | [catalin.marinas@arm.com: squashed the original function patch and macro fixup] | |
23 | Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> | |
24 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
25 | --- | |
26 | include/asm-generic/fixmap.h | 12 ++++++------ | |
27 | 1 file changed, 6 insertions(+), 6 deletions(-) | |
28 | ||
29 | diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h | |
30 | index f23174fb9ec4..10889b63af8f 100644 | |
31 | --- a/include/asm-generic/fixmap.h | |
32 | +++ b/include/asm-generic/fixmap.h | |
33 | @@ -67,12 +67,12 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr) | |
34 | #endif | |
35 | ||
36 | /* Return a pointer with offset calculated */ | |
37 | -#define __set_fixmap_offset(idx, phys, flags) \ | |
38 | -({ \ | |
39 | - unsigned long addr; \ | |
40 | - __set_fixmap(idx, phys, flags); \ | |
41 | - addr = fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); \ | |
42 | - addr; \ | |
43 | +#define __set_fixmap_offset(idx, phys, flags) \ | |
44 | +({ \ | |
45 | + unsigned long ________addr; \ | |
46 | + __set_fixmap(idx, phys, flags); \ | |
47 | + ________addr = fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); \ | |
48 | + ________addr; \ | |
49 | }) | |
50 | ||
51 | #define set_fixmap_offset(idx, phys) \ | |
52 | -- | |
53 | 2.19.1 | |
54 |