Skip to content

Commit

Permalink
core/cpu: Call memset with proper cpu_thread offset
Browse files Browse the repository at this point in the history
"cpu_thread *t + value" vs "(void *)t + val"

Fixes: cfe9d44 (core/cpu: Prevent clobbering of stack guard for boot-cpu)
CC: stable <skiboot@lists.ozlabs.org> # v6.0+
CC: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
CC: Nicholas Piggin <npiggin@gmail.com>
CC: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Acked-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Reviewed-by: Vaibhav Jain<vaibhav@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
Vasant Hegde authored and stewartsmith committed Aug 14, 2018
1 parent 8bb4a1c commit 15880d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 15880d5

Please sign in to comment.