]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/asm-generic-fix-local-variable-shadow-in-__set_fixma.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / asm-generic-fix-local-variable-shadow-in-__set_fixma.patch
1 From 7946bf63085a1c37d9b36f08e3c0e089df794e0d 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 1cbb8338edf3..827e4d3bbc7a 100644
31 --- a/include/asm-generic/fixmap.h
32 +++ b/include/asm-generic/fixmap.h
33 @@ -70,12 +70,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