[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190523221210.4a2bb326@oasis.local.home>
Date: Thu, 23 May 2019 22:12:10 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Ingo Molnar <mingo@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tracing: silence GCC 9 array bounds warning
On Thu, 23 May 2019 14:45:35 +0200
Miguel Ojeda <miguel.ojeda.sandonis@...il.com> 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 trace_iterator_reset(struct trace_iterator *iter)
> +{
> + const size_t offset = offsetof(struct trace_iterator, seq);
> +
> + /*
> + * Keep gcc from complaining about overwriting more than just one
> + * member in the structure.
> + */
> + memset((char *)(iter) + offset, 0, sizeof(struct trace_iterator) - offset);
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 are unnecessary. I'll remove them.
-- Steve
> +
> + iter->pos = -1;
> +}
> +
Powered by blists - more mailing lists