summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/thread_info.h
diff options
context:
space:
mode:
authorSahara <keun-o.park@darkmatter.ae>2017-02-16 21:29:15 +0300
committerKees Cook <keescook@chromium.org>2017-04-05 00:30:29 +0300
commit96dc4f9fb64690fc34410415fd1fc609cf803f61 (patch)
tree31971ed38668c7492910a70da3b6e1faf5f0509f /arch/x86/include/asm/thread_info.h
parent4495c08e84729385774601b5146d51d9e5849f81 (diff)
downloadlinux-96dc4f9fb64690fc34410415fd1fc609cf803f61.tar.xz
usercopy: Move enum for arch_within_stack_frames()
This patch moves the arch_within_stack_frames() return value enum up in the header files so that per-architecture implementations can reuse the same return values. Signed-off-by: Sahara <keun-o.park@darkmatter.ae> Signed-off-by: James Morse <james.morse@arm.com> [kees: adjusted naming and commit log] Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'arch/x86/include/asm/thread_info.h')
-rw-r--r--arch/x86/include/asm/thread_info.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index ad6f5eb07a95..920ca1f7adea 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -168,9 +168,9 @@ static inline unsigned long current_stack_pointer(void)
* entirely contained by a single stack frame.
*
* Returns:
- * 1 if within a frame
- * -1 if placed across a frame boundary (or outside stack)
- * 0 unable to determine (no frame pointers, etc)
+ * GOOD_FRAME if within a frame
+ * BAD_STACK if placed across a frame boundary (or outside stack)
+ * NOT_STACK unable to determine (no frame pointers, etc)
*/
static inline int arch_within_stack_frames(const void * const stack,
const void * const stackend,
@@ -197,13 +197,14 @@ static inline int arch_within_stack_frames(const void * const stack,
* the copy as invalid.
*/
if (obj + len <= frame)
- return obj >= oldframe + 2 * sizeof(void *) ? 1 : -1;
+ return obj >= oldframe + 2 * sizeof(void *) ?
+ GOOD_FRAME : BAD_STACK;
oldframe = frame;
frame = *(const void * const *)frame;
}
- return -1;
+ return BAD_STACK;
#else
- return 0;
+ return NOT_STACK;
#endif
}