Messages in this thread Patch in this message | | | Date | Sat, 25 Apr 2020 18:05:37 -0700 | From | Andrew Morton <> | Subject | Re: [PATCH 2/4] riscv: support DEBUG_WX |
| |
On Tue, 21 Apr 2020 16:17:13 +0800 Zong Li <zong.li@sifive.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 */ _
| |