[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200425180537.063e976b232f8771e22f7ee1@linux-foundation.org>
Date: Sat, 25 Apr 2020 18:05:37 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Zong Li <zong.li@...ive.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
paul.walmsley@...ive.com, palmer@...belt.com,
linux-riscv@...ts.infradead.org, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, x86@...nel.org, hpa@...or.com,
catalin.marinas@....com, will@...nel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 2/4] riscv: support DEBUG_WX
On Tue, 21 Apr 2020 16:17:13 +0800 Zong Li <zong.li@...ive.com> wrote:
> Support DEBUG_WX to check whether there are mapping with write and
> execute permission at the same time.
>
> --- a/arch/riscv/include/asm/ptdump.h
> +++ b/arch/riscv/include/asm/ptdump.h
> @@ -8,4 +8,10 @@
>
> void ptdump_check_wx(void);
>
> +#ifdef CONFIG_DEBUG_WX
> +#define debug_checkwx() ptdump_check_wx()
> +#else
> +#define debug_checkwx() do { } while (0)
> +#endif
> +
> #endif /* _ASM_RISCV_PTDUMP_H */
It's preferred to implement things in regular C, unless they MUST be
implemented in the preprocessor. So...
--- a/arch/riscv/include/asm/ptdump.h~riscv-support-debug_wx-fix
+++ a/arch/riscv/include/asm/ptdump.h
@@ -9,9 +9,14 @@
void ptdump_check_wx(void);
#ifdef CONFIG_DEBUG_WX
-#define debug_checkwx() ptdump_check_wx()
+static inline void debug_checkwx(void)
+{
+ ptdump_check_wx();
+}
#else
-#define debug_checkwx() do { } while (0)
+static inline void debug_checkwx(void)
+{
+}
#endif
#endif /* _ASM_RISCV_PTDUMP_H */
_
Powered by blists - more mailing lists