[Skiboot] [PATCH] core/cpu: Call memset with proper cpu_thread offset

Ananth N Mavinakayanahalli ananth at linux.vnet.ibm.com
Wed Aug 8 13:40:59 AEST 2018


On Tue, Aug 07, 2018 at 04:37:13PM +0530, Vasant Hegde wrote:
> "cpu_thread *t + value" vs "(void *)t + val"
> 
> Fixes: cfe9d441 (core/cpu: Prevent clobbering of stack guard for boot-cpu)
> CC: stable <skiboot at lists.ozlabs.org> # v6.0+
> CC: Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
> CC: Nicholas Piggin <npiggin at gmail.com>
> CC: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
> Acked-by: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
> Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
> ---
>  core/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/core/cpu.c b/core/cpu.c
> index b5bfb2773..9d7532962 100644
> --- a/core/cpu.c
> +++ b/core/cpu.c
> @@ -889,7 +889,7 @@ static void init_cpu_thread(struct cpu_thread *t,
>  	const size_t guard_skip = container_off_var(t, stack_guard) +
>  		sizeof(t->stack_guard);
> 
> -	memset(t + guard_skip, 0, sizeof(struct cpu_thread) - guard_skip);
> +	memset(((void *)t) + guard_skip, 0, sizeof(struct cpu_thread) - guard_skip);
>  	init_lock(&t->dctl_lock);
>  	init_lock(&t->job_lock);
>  	list_head_init(&t->job_queue);

Candidate for stable releases too, right?



More information about the Skiboot mailing list