linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv3 01/18] asm-generic: make __set_fixmap_offset a static inline
Date: Mon, 25 Jan 2016 11:44:55 +0000	[thread overview]
Message-ID: <1453722312-23076-2-git-send-email-mark.rutland@arm.com> (raw)
In-Reply-To: <1453722312-23076-1-git-send-email-mark.rutland@arm.com>

Currently __set_fixmap_offset is a macro function which has a local
variable called 'addr'. If a caller passes a 'phys' parameter which is
derived from a variable also called 'addr', the local variable will
shadow this, and the compiler will complain about the use of an
uninitialized variable.

It is likely that fixmap users may use the name 'addr' for variables
that may be directly passed to __set_fixmap_offset, or that may be
indirectly generated via other macros. Rather than placing the burden on
callers to avoid the name 'addr', this patch changes __set_fixmap_offset
into a static inline function, avoiding namespace collisions.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Jeremy Linton <jeremy.linton@arm.com>
Cc: Laura Abbott <labbott@fedoraproject.org>
Cc: Will Deacon <will.deacon@arm.com>
---
 include/asm-generic/fixmap.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h
index 1cbb833..f9c27b6 100644
--- a/include/asm-generic/fixmap.h
+++ b/include/asm-generic/fixmap.h
@@ -70,13 +70,13 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
 #endif
 
 /* Return a pointer with offset calculated */
-#define __set_fixmap_offset(idx, phys, flags)		      \
-({							      \
-	unsigned long addr;				      \
-	__set_fixmap(idx, phys, flags);			      \
-	addr = fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); \
-	addr;						      \
-})
+static inline unsigned long __set_fixmap_offset(enum fixed_addresses idx,
+						phys_addr_t phys,
+						pgprot_t flags)
+{
+	__set_fixmap(idx, phys, flags);
+	return fix_to_virt(idx) + (phys & (PAGE_SIZE - 1));
+}
 
 #define set_fixmap_offset(idx, phys) \
 	__set_fixmap_offset(idx, phys, FIXMAP_PAGE_NORMAL)
-- 
1.9.1

  reply	other threads:[~2016-01-25 11:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 11:44 [PATCHv3 00/18] arm64: mm: rework page table creation Mark Rutland
2016-01-25 11:44 ` Mark Rutland [this message]
2016-01-25 11:44 ` [PATCHv3 02/18] arm64: mm: specialise pagetable allocators Mark Rutland
2016-01-25 11:44 ` [PATCHv3 03/18] arm64: mm: place empty_zero_page in bss Mark Rutland
2016-01-25 11:44 ` [PATCHv3 04/18] arm64: unify idmap removal Mark Rutland
2016-01-25 11:44 ` [PATCHv3 05/18] arm64: unmap idmap earlier Mark Rutland
2016-01-25 11:45 ` [PATCHv3 06/18] arm64: add function to install the idmap Mark Rutland
2016-01-25 11:45 ` [PATCHv3 07/18] arm64: mm: add code to safely replace TTBR1_EL1 Mark Rutland
2016-01-25 11:45 ` [PATCHv3 08/18] arm64: kasan: avoid TLB conflicts Mark Rutland
2016-01-25 11:45 ` [PATCHv3 09/18] arm64: mm: move pte_* macros Mark Rutland
2016-01-25 11:45 ` [PATCHv3 10/18] arm64: mm: add functions to walk page tables by PA Mark Rutland
2016-01-25 11:45 ` [PATCHv3 11/18] arm64: mm: avoid redundant __pa(__va(x)) Mark Rutland
2016-01-25 11:45 ` [PATCHv3 12/18] arm64: mm: add __{pud,pgd}_populate Mark Rutland
2016-01-25 11:45 ` [PATCHv3 13/18] arm64: mm: add functions to walk tables in fixmap Mark Rutland
2016-01-25 11:45 ` [PATCHv3 14/18] arm64: mm: use fixmap when creating page tables Mark Rutland
2016-01-25 11:45 ` [PATCHv3 15/18] arm64: mm: allocate pagetables anywhere Mark Rutland
2016-01-25 11:45 ` [PATCHv3 16/18] arm64: mm: allow passing a pgdir to alloc_init_* Mark Rutland
2016-01-25 11:45 ` [PATCHv3 17/18] arm64: ensure _stext and _etext are page-aligned Mark Rutland
2016-01-25 11:45 ` [PATCHv3 18/18] arm64: mm: create new fine-grained mappings at boot Mark Rutland
2016-01-27 15:43 ` [PATCHv3 00/18] arm64: mm: rework page table creation Jeremy Linton
2016-01-28 15:07 ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453722312-23076-2-git-send-email-mark.rutland@arm.com \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).