[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJWu+optxZYJ=RdmconCGMHQRgJqv=0k6NKAzEWui1smXieToA@mail.gmail.com>
Date: Thu, 1 Jul 2021 14:09:12 -0400
From: Joel Fernandes <joelaf@...gle.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Paul Burton <paulburton@...gle.com>, linux-kernel@...r.kernel.org,
Ingo Molnar <mingo@...hat.com>, stable@...r.kernel.org
Subject: Re: [PATCH 1/2] tracing: Simplify & fix saved_tgids logic
On Thu, Jul 1, 2021 at 2:07 PM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Thu, 1 Jul 2021 10:31:59 -0700
> Paul Burton <paulburton@...gle.com> wrote:
>
> > I was tempted to just add the redundant checks anyway (pick your battles
> > and all) but for show() in particular it wound up making things seem
> > non-sensical to me ("display the value describing this non-NULL pointer
> > into tgid_map only if tgid_map is not NULL?").
>
> I agree with your assessment, and will actually take your first patch,
> as I don't think the comment is that helpful, not to mention, we don't
> use '//' comments in the kernel, so that would have to be changed.
>
> But for cases like this, I usually have something like:
>
>
> if (WARN_ON_ONCE(!tgid_map))
> return -1;
>
> Because the logic is what makes tgid_map not being NULL, but as
> experience has taught me, the logic can sometimes be mistaken, at least
> as time goes by. And things that are protected by logic, deserve a
> WARN*() when it doesn't go as planned.
>
> We can always add that later, if needed.
Agreed, was thinking similar/same.
thanks,
-Joel
Powered by blists - more mailing lists