From: Steven Rostedt <rostedt@goodmis.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] tracing: silence GCC 9 array bounds warning
Date: Wed, 22 May 2019 07:52:27 -0400 [thread overview]
Message-ID: <20190522075227.52ae4720@gandalf.local.home> (raw)
In-Reply-To: <20190522095810.GA16110@gmail.com>
On Wed, 22 May 2019 11:58:10 +0200
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote:
> +/* reset all but tr, trace, and overruns */
> +static __always_inline void trace_iterator_reset(struct trace_iterator *iter)
> +{
> + /*
> + * We do not simplify the start address to &iter->seq in order to let
> + * GCC 9 know that we really want to overwrite more members than
> + * just iter->seq (-Warray-bounds).
This comment is fine for the change log, but here it is too specific.
Why does one care about GCC 9 when we are at version GCC 21? I care
more about why we are clearing the data and less about the way we are
doing it.
A comment like:
/*
* 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.
*/
That is more useful than why we have the offset hack.
> + */
> + const size_t offset = offsetof(struct trace_iterator, seq);
Need a empty line between these two.
-- Steve
> + memset((char *)(iter) + offset, 0, sizeof(struct trace_iterator) - offset);
> +
> + iter->pos = -1;
> +}
> +
> #endif /* _LINUX_KERNEL_TRACE_H */
next prev parent reply other threads:[~2019-05-22 11:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-22 9:58 [PATCH v2] tracing: silence GCC 9 array bounds warning Miguel Ojeda
2019-05-22 11:52 ` Steven Rostedt [this message]
2019-05-22 13:11 ` Miguel Ojeda
2019-05-22 13:34 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190522075227.52ae4720@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=mingo@redhat.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).