Changeset 59d0e6a in rtems


Ignore:
Timestamp:
Oct 5, 2020, 2:20:44 PM (8 weeks ago)
Author:
Frank Kühndel <frank.kuehndel@…>
Branches:
master
Children:
0007d65
Parents:
3bbd476
git-author:
Frank Kühndel <frank.kuehndel@…> (10/05/20 14:20:44)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/10/20 13:02:56)
Message:

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);

| ~

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/capture/capture_support.c

    r3bbd476 r59d0e6a  
    8282 */
    8383static void
    84 ctrace_task_name_add (rtems_id id, const rtems_name* name)
     84ctrace_task_name_add (rtems_id id, const rtems_name name)
    8585{
    8686  if (tasks.tasks == NULL)
     
    9898        if (tasks.tasks[t].id == id)
    9999        {
    100           tasks.tasks[t].name = *name;
     100          tasks.tasks[t].name = name;
    101101          break;
    102102        }
     
    112112        if (tasks.tasks != NULL)
    113113        {
    114           tasks.tasks[tasks.count].name = *name;
     114          tasks.tasks[tasks.count].name = name;
    115115          tasks.tasks[tasks.count].id = id;
    116116          ++tasks.count;
     
    350350                                                  &task_rec,
    351351                                                  sizeof (task_rec));
    352         ctrace_task_name_add (rec_out->task_id, &task_rec.name);
     352        ctrace_task_name_add (rec_out->task_id, task_rec.name);
    353353        rtems_capture_print_record_task (cpu_out, rec_out, &task_rec);
    354354      }
Note: See TracChangeset for help on using the changeset viewer.