]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-3.18/asm-generic-fix-local-variable-shadow-in-__set_fixma.patch
fix up powerpc patch headers, I messed up.
[thirdparty/kernel/stable-queue.git] / queue-3.18 / asm-generic-fix-local-variable-shadow-in-__set_fixma.patch
CommitLineData
de78ab3b
SL
1From 8c7453632eac75cb83a55878d5034d1dd3fe8c71 Mon Sep 17 00:00:00 2001
2From: Mark Rutland <mark.rutland@arm.com>
3Date: Mon, 25 Jan 2016 11:44:55 +0000
4Subject: asm-generic: Fix local variable shadow in __set_fixmap_offset
5
6[ Upstream commit 3694bd76781b76c4f8d2ecd85018feeb1609f0e5 ]
7
8Currently __set_fixmap_offset is a macro function which has a local
9variable called 'addr'. If a caller passes a 'phys' parameter which is
10derived from a variable also called 'addr', the local variable will
11shadow this, and the compiler will complain about the use of an
12uninitialized variable. To avoid the issue with namespace clashes,
13'addr' is prefixed with a liberal sprinkling of underscores.
14
15Turning __set_fixmap_offset into a static inline breaks the build for
16several architectures. Fixing this properly requires updates to a number
17of architectures to make them agree on the prototype of __set_fixmap (it
18could be done as a subsequent patch series).
19
20Signed-off-by: Mark Rutland <mark.rutland@arm.com>
21Cc: Arnd Bergmann <arnd@arndb.de>
22[catalin.marinas@arm.com: squashed the original function patch and macro fixup]
23Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
24Signed-off-by: Sasha Levin <sashal@kernel.org>
25---
26 include/asm-generic/fixmap.h | 12 ++++++------
27 1 file changed, 6 insertions(+), 6 deletions(-)
28
29diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h
30index 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--
532.19.1
54