Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit a359befa authored by Quentin Perret's avatar Quentin Perret
Browse files

ANDROID: sched/events: Fix out of bound memory access



GCC 8 provides the following warning:

./include/trace/events/sched.h:736:3: warning: ‘memcpy’ forming offset
[8, 16] is out of the bounds [0, 7] [-Warray-bounds]
   memcpy(__entry->comm, p ? p->comm : "(null)", TASK_COMM_LEN);

Indeed, in the case where p==NULL, we copy TASK_COMM_LEN bytes from the
memory location where "(null)" is stored, which is incorrect.

Fix this by making sure to pass the right size parameter to memcpy in
all cases.

Bug: 120440300
Test: Compilation warning gone, no changes noticed in traces
Fixes: 42903694 ("ANDROID: sched/events: Introduce sched_entity load
tracking trace event")
Change-Id: Id93c9c0265f10c09b731daca25401696785b4b1e
Suggested-by: default avatarDietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: default avatarQuentin Perret <quentin.perret@arm.com>
parent 67319b77
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment