From: Dan Carpenter <dan.carpenter@oracle.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] Silence an uninitialized variable warning
Date: Thu, 05 Dec 2019 10:02:20 +0000 [thread overview]
Message-ID: <20191205100220.GH1765@kadam> (raw)
In-Reply-To: <20191205093229.GE2810@hirez.programming.kicks-ass.net>
On Thu, Dec 05, 2019 at 10:32:29AM +0100, Peter Zijlstra wrote:
> On Wed, Dec 04, 2019 at 09:42:47PM +0300, Dan Carpenter wrote:
>
> > > The current code has this:
> > >
> > > static int __init syscall_enter_define_fields(struct trace_event_call *call)
> > > {
> > > struct syscall_trace_enter trace;
> > > struct syscall_metadata *meta = call->data;
> > > int ret;
> > > int i;
> > > int offset = offsetof(typeof(trace), args);
> > >
> > > ret = trace_define_field(call, SYSCALL_FIELD(int, nr, __syscall_nr),
> > > FILTER_OTHER);
> >
> > In linux-next this ret = trace_define_field() assignment is removed.
> > That was commit 60fdad00827c ("ftrace: Rework event_create_dir()").
>
> Yep, mea culpa.
>
> > > if (ret)
> > > return ret;
> > >
> > > for (i = 0; i < meta->nb_args; i++) {
> > > ret = trace_define_field(call, meta->types[i],
> > > meta->args[i], offset,
> > > sizeof(unsigned long), 0,
> > > FILTER_OTHER);
> > > offset += sizeof(unsigned long);
> > > }
> > >
> > > return ret;
> > > }
> > >
> > >
> > > How can ret possibly be uninitialized?
> >
> > I should have written this commit more carefully and verified whether
> > meta->nb_args can actually be zero instead of just assuming it was a
> > false positive...
>
> Right, I'm thinking this is in fact possible. We have syscalls without
> arguments (sys_sched_yield for exmaple).
Well, it would have triggered a run time bug because of that thing with
GCC where it sometimes initializes variables to zero.
Let me resend properly with a Fixes tag.
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] Silence an uninitialized variable warning
Date: Thu, 5 Dec 2019 13:02:20 +0300 [thread overview]
Message-ID: <20191205100220.GH1765@kadam> (raw)
In-Reply-To: <20191205093229.GE2810@hirez.programming.kicks-ass.net>
On Thu, Dec 05, 2019 at 10:32:29AM +0100, Peter Zijlstra wrote:
> On Wed, Dec 04, 2019 at 09:42:47PM +0300, Dan Carpenter wrote:
>
> > > The current code has this:
> > >
> > > static int __init syscall_enter_define_fields(struct trace_event_call *call)
> > > {
> > > struct syscall_trace_enter trace;
> > > struct syscall_metadata *meta = call->data;
> > > int ret;
> > > int i;
> > > int offset = offsetof(typeof(trace), args);
> > >
> > > ret = trace_define_field(call, SYSCALL_FIELD(int, nr, __syscall_nr),
> > > FILTER_OTHER);
> >
> > In linux-next this ret = trace_define_field() assignment is removed.
> > That was commit 60fdad00827c ("ftrace: Rework event_create_dir()").
>
> Yep, mea culpa.
>
> > > if (ret)
> > > return ret;
> > >
> > > for (i = 0; i < meta->nb_args; i++) {
> > > ret = trace_define_field(call, meta->types[i],
> > > meta->args[i], offset,
> > > sizeof(unsigned long), 0,
> > > FILTER_OTHER);
> > > offset += sizeof(unsigned long);
> > > }
> > >
> > > return ret;
> > > }
> > >
> > >
> > > How can ret possibly be uninitialized?
> >
> > I should have written this commit more carefully and verified whether
> > meta->nb_args can actually be zero instead of just assuming it was a
> > false positive...
>
> Right, I'm thinking this is in fact possible. We have syscalls without
> arguments (sys_sched_yield for exmaple).
Well, it would have triggered a run time bug because of that thing with
GCC where it sometimes initializes variables to zero.
Let me resend properly with a Fixes tag.
regards,
dan carpenter
next prev parent reply other threads:[~2019-12-05 10:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-26 12:19 [PATCH] Silence an uninitialized variable warning Dan Carpenter
2019-11-26 12:19 ` Dan Carpenter
2019-12-04 14:26 ` Steven Rostedt
2019-12-04 14:26 ` Steven Rostedt
2019-12-04 18:42 ` Dan Carpenter
2019-12-04 18:42 ` Dan Carpenter
2019-12-05 9:32 ` Peter Zijlstra
2019-12-05 9:32 ` Peter Zijlstra
2019-12-05 10:02 ` Dan Carpenter [this message]
2019-12-05 10:02 ` Dan Carpenter
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=20191205100220.GH1765@kadam \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.