android_kernel_samsung_a7y1.../kernel/trace
Miguel Ojeda aa04b331fe tracing: Silence GCC 9 array bounds warning
commit 0c97bf863efce63d6ab7971dad811601e6171d2f upstream.

Starting with GCC 9, -Warray-bounds detects cases when memset is called
starting on a member of a struct but the size to be cleared ends up
writing over further members.

Such a call happens in the trace code to clear, at once, all members
after and including `seq` on struct trace_iterator:

    In function 'memset',
        inlined from 'ftrace_dump' at kernel/trace/trace.c:8914:3:
    ./include/linux/string.h:344:9: warning: '__builtin_memset' offset
    [8505, 8560] from the object at 'iter' is out of the bounds of
    referenced subobject 'seq' with type 'struct trace_seq' at offset
    4368 [-Warray-bounds]
      344 |  return __builtin_memset(p, c, size);
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

In order to avoid GCC complaining about it, we compute the address
ourselves by adding the offsetof distance instead of referring
directly to the member.

Since there are two places doing this clear (trace.c and trace_kdb.c),
take the chance to move the workaround into a single place in
the internal header.

Link: http://lkml.kernel.org/r/20190523124535.GA12931@gmail.com

Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
[ Removed unnecessary parenthesis around "iter" ]
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-06 19:14:20 +02:00
..
blktrace.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bpf_trace.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ftrace.c kprobes: Mark ftrace mcount handler functions nokprobe 2020-04-06 15:57:02 +02:00
gpu-traces.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
power-traces.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ring_buffer_benchmark.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ring_buffer.c trace: Fix preempt_enable_no_resched() abuse 2020-04-06 16:38:41 +02:00
rpm-traces.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_benchmark.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_benchmark.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_branch.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_clock.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_entries.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_event_perf.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_events_filter_test.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_events_filter.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_events_trigger.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_events.c tracing: Fix partial reading of trace event's id file 2020-04-06 18:14:00 +02:00
trace_export.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_functions_graph.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_functions.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_irqsoff.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_kdb.c tracing: Silence GCC 9 array bounds warning 2020-04-06 19:14:20 +02:00
trace_kprobe.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_mmiotrace.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_nop.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_output.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_output.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_printk.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_probe.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_probe.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_sched_switch.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_sched_wakeup.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_selftest_dynamic.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_selftest.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_seq.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_stack.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_stat.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_stat.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_syscalls.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace_uprobe.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
trace.c tracing: Silence GCC 9 array bounds warning 2020-04-06 19:14:20 +02:00
trace.h tracing: Silence GCC 9 array bounds warning 2020-04-06 19:14:20 +02:00