Skip to content

Commit 32e42ab

Browse files
committed
sched/task_stack: Add missing const qualifier to end_of_stack()
Add missing const qualifier to the non-CONFIG_THREAD_INFO_IN_TASK version of end_of_stack() to match the CONFIG_THREAD_INFO_IN_TASK version. Fixes a warning with CONFIG_KSTACK_ERASE=y on archs that don't select THREAD_INFO_IN_TASK (such as LoongArch): error: passing 'const struct task_struct *' to parameter of type 'struct task_struct *' discards qualifiers The stackleak_task_low_bound() function correctly uses a const task parameter, but the legacy end_of_stack() prototype didn't like that. Build tested on loongarch (with CONFIG_KSTACK_ERASE=y) and m68k (with CONFIG_DEBUG_STACK_USAGE=y). Fixes: a45728f ("LoongArch: Enable HAVE_ARCH_STACKLEAK") Reported-by: Nathan Chancellor <[email protected]> Closes: https://lore.kernel.org/all/20250726004313.GA3650901@ax162 Cc: Youling Tang <[email protected]> Cc: Huacai Chen <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent a8f0b1f commit 32e42ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/sched/task_stack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static inline void setup_thread_stack(struct task_struct *p, struct task_struct
5353
* When the stack grows up, this is the highest address.
5454
* Beyond that position, we corrupt data on the next page.
5555
*/
56-
static inline unsigned long *end_of_stack(struct task_struct *p)
56+
static inline unsigned long *end_of_stack(const struct task_struct *p)
5757
{
5858
#ifdef CONFIG_STACK_GROWSUP
5959
return (unsigned long *)((unsigned long)task_thread_info(p) + THREAD_SIZE) - 1;

0 commit comments

Comments
 (0)