From 59d0e6aed1efea068cea13651dc1d2b7c2809fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20K=C3=BChndel?= Date: Mon, 5 Oct 2020 16:20:44 +0200 Subject: capture: Fix unaligned pointer value warning rtems_name is a four byte integer. Giving an rtems_name as value instead of a pointer to ctrace_task_name_add() fixes not only the compiler warning but it is also a bit more safe For those who have asked for the warning: ../../../cpukit/libmisc/capture/capture_support.c:352:49: warning: taking address of packed member of 'struct rtems_capture_task_record' may result in an unaligned pointer value [-Waddress-of-packed-member] 352 | ctrace_task_name_add (rec_out->task_id, &task_rec.name); | ^~~~~~~~~~~~~~ --- cpukit/libmisc/capture/capture_support.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cpukit/libmisc') diff --git a/cpukit/libmisc/capture/capture_support.c b/cpukit/libmisc/capture/capture_support.c index 4af8822c79..e2438fb23b 100644 --- a/cpukit/libmisc/capture/capture_support.c +++ b/cpukit/libmisc/capture/capture_support.c @@ -81,7 +81,7 @@ static ctrace_tasks tasks; * Add a name. */ static void -ctrace_task_name_add (rtems_id id, const rtems_name* name) +ctrace_task_name_add (rtems_id id, const rtems_name name) { if (tasks.tasks == NULL) { @@ -97,7 +97,7 @@ ctrace_task_name_add (rtems_id id, const rtems_name* name) { if (tasks.tasks[t].id == id) { - tasks.tasks[t].name = *name; + tasks.tasks[t].name = name; break; } } @@ -111,7 +111,7 @@ ctrace_task_name_add (rtems_id id, const rtems_name* name) } if (tasks.tasks != NULL) { - tasks.tasks[tasks.count].name = *name; + tasks.tasks[tasks.count].name = name; tasks.tasks[tasks.count].id = id; ++tasks.count; } @@ -349,7 +349,7 @@ rtems_capture_print_trace_records (int total, bool csv) cpu->recs = rtems_capture_record_extract (cpu->recs, &task_rec, sizeof (task_rec)); - ctrace_task_name_add (rec_out->task_id, &task_rec.name); + ctrace_task_name_add (rec_out->task_id, task_rec.name); rtems_capture_print_record_task (cpu_out, rec_out, &task_rec); } else -- cgit v1.2.3