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:Dietmar Eggemann <dietmar.eggemann@arm.com> Signed-off-by:
Quentin Perret <quentin.perret@arm.com>
Loading
Please register or sign in to comment