Re: [PATCH] tracing: silence GCC 9 array bounds warning

2019-05-24 Thread Steven Rostedt
On Fri, 24 May 2019 06:05:36 +0200 Miguel Ojeda wrote: > On Fri, May 24, 2019 at 4:12 AM Steven Rostedt wrote: > > > > On Thu, 23 May 2019 14:45:35 +0200 > > Miguel Ojeda wrote: > > > > I still prefer the typecast of void *, as that's used a bit more in the > > kernel, but since char * is also

Re: [PATCH] tracing: silence GCC 9 array bounds warning

2019-05-23 Thread Miguel Ojeda
On Fri, May 24, 2019 at 4:12 AM Steven Rostedt wrote: > > On Thu, 23 May 2019 14:45:35 +0200 > Miguel Ojeda wrote: > > I still prefer the typecast of void *, as that's used a bit more in the > kernel, but since char * is also used (not as much), I'll leave it. But > the parenthesis around iter ar

Re: [PATCH] tracing: silence GCC 9 array bounds warning

2019-05-23 Thread Steven Rostedt
On Thu, 23 May 2019 14:45:35 +0200 Miguel Ojeda wrote: > +/* > + * Reset the state of the trace_iterator so that it can read consumed data. > + * Normally, the trace_iterator is used for reading the data when it is not > + * consumed, and must retain state. > + */ > +static __always_inline void t

[PATCH] tracing: silence GCC 9 array bounds warning

2019-05-23 Thread Miguel Ojeda
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

Re: [PATCH] tracing: silence GCC 9 array bounds warning

2019-05-19 Thread Steven Rostedt
On Fri, 17 May 2019 21:09:21 +0200 Miguel Ojeda wrote: > By the way, how do you all feel about moving this as a generic > facility to zero out the suffix/prefix of an structure? In particular, > since we won't have the LAT* stuff according to Steven. Is this done in other places? If so, how many

Re: [PATCH] tracing: silence GCC 9 array bounds warning

2019-05-17 Thread Miguel Ojeda
On Fri, May 17, 2019 at 11:25 AM Miguel Ojeda wrote: > > ./include/linux/string.h:344:9: warning: '__builtin_memset' offset > [8505, 8560] from the object at 'iter' is out of the bounds of By the way, I noticed these offsets of the new warning seem to be off by 1, reported here: http

Re: [PATCH] tracing: silence GCC 9 array bounds warning

2019-05-17 Thread Miguel Ojeda
On Fri, May 17, 2019 at 7:59 PM Linus Torvalds wrote: > > On Fri, May 17, 2019 at 2:25 AM Miguel Ojeda > wrote: > > > > + memset((char *)(iter) + offsetof(struct trace_iterator, seq), 0, > > + sizeof(struct trace_iterator) - > > + offsetof(struct trace_iterator, se

Re: [PATCH] tracing: silence GCC 9 array bounds warning

2019-05-17 Thread Miguel Ojeda
Hi Steven, On Fri, May 17, 2019 at 6:47 PM Steven Rostedt wrote: > > Hi Miguel, > > Linus mentioned this too. > > > https://lore.kernel.org/lkml/CAHk-=wihyb8w__yqjgyjyzsvniu5ctktcfycmcgdqvg8guj...@mail.gmail.com/T/#u Ah, I didn't see that. We were discussing here [1] backporting to 4.19 some c

Re: [PATCH] tracing: silence GCC 9 array bounds warning

2019-05-17 Thread Linus Torvalds
On Fri, May 17, 2019 at 2:25 AM Miguel Ojeda wrote: > > + memset((char *)(iter) + offsetof(struct trace_iterator, seq), 0, > + sizeof(struct trace_iterator) - > + offsetof(struct trace_iterator, seq)); Honestly, the above is nasty. Whenever you have to split an ex

Re: [PATCH] tracing: silence GCC 9 array bounds warning

2019-05-17 Thread Steven Rostedt
On Fri, 17 May 2019 11:25:02 +0200 Miguel Ojeda wrote: > 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

[PATCH] tracing: silence GCC 9 array bounds warning

2019-05-17 Thread Miguel Ojeda
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