Commit 2341964e authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/kuap: Remove __kuap_assert_locked()

__kuap_assert_locked() is redundant with
__kuap_get_and_assert_locked().

Move the verification of CONFIG_PPC_KUAP_DEBUG in kuap_assert_locked()
and make it call __kuap_get_and_assert_locked() directly.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1a60198a25d2ba38a37f1b92bc7d096435df4224.1634627931.git.christophe.leroy@csgroup.eu
parent c252f384
......@@ -117,11 +117,6 @@ static inline unsigned long __kuap_get_and_assert_locked(void)
return kuap;
}
static inline void __kuap_assert_locked(void)
{
__kuap_get_and_assert_locked();
}
static __always_inline void __allow_user_access(void __user *to, const void __user *from,
u32 size, unsigned long dir)
{
......
......@@ -298,12 +298,6 @@ static inline unsigned long __kuap_get_and_assert_locked(void)
return amr;
}
static inline void __kuap_assert_locked(void)
{
if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG))
WARN_ON_ONCE(mfspr(SPRN_AMR) != AMR_KUAP_BLOCKED);
}
/*
* We support individually allowing read or write, but we don't support nesting
* because that would require an expensive read/modify write of the AMR.
......
......@@ -86,7 +86,8 @@ static __always_inline void kuap_assert_locked(void)
if (kuap_is_disabled())
return;
__kuap_assert_locked();
if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG))
__kuap_get_and_assert_locked();
}
#ifdef CONFIG_PPC32
......
......@@ -47,12 +47,6 @@ static inline unsigned long __kuap_get_and_assert_locked(void)
return kuap;
}
static inline void __kuap_assert_locked(void)
{
if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG))
__kuap_get_and_assert_locked();
}
static inline void __allow_user_access(void __user *to, const void __user *from,
unsigned long size, unsigned long dir)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment