All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Cc: Ian Rogers <irogers@google.com>
Subject: [PATCH] libtracefs: Remove unneeded check of !dynevent in dynevent_info()
Date: Thu, 15 Dec 2022 15:55:34 -0500	[thread overview]
Message-ID: <20221215155534.1616b67a@gandalf.local.home> (raw)

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The compiler was complaining about undefined behavior because
dynevent_info() was accessing the address of &dynevent->system and later
doing a if (!dynevent). But this was fixed by creating a wrapper function
that does the checks and then passes the information to this function.

But that commit forgot to remove the check of !dynevent leaving the
compiler to believe that it can still be NULL and that the undefined
behavior of &dynevent->system still exists.

Remove the if statement and make everyone happy.

Link: https://lore.kernel.org/linux-trace-devel/20221215140203.103faf50@gandalf.local.home/

Reported-by: Ian Rogers <irogers@google.com>
Fixes: aff006d4af0c7 ("libtracefs: Do not initialize with NULL offsets")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/tracefs-dynevents.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/tracefs-dynevents.c b/src/tracefs-dynevents.c
index 48bb26a96c58..7a3c45ce25a3 100644
--- a/src/tracefs-dynevents.c
+++ b/src/tracefs-dynevents.c
@@ -713,9 +713,6 @@ dynevent_info(struct tracefs_dynevent *dynevent, char **system,
 			&dynevent->address, &dynevent->format };
 	int i;
 
-	if (!dynevent)
-		return TRACEFS_DYNEVENT_UNKNOWN;
-
 	for (i = 0; i < ARRAY_SIZE(lv); i++) {
 		if (lv[i]) {
 			if (*rv[i]) {
-- 
2.35.1


                 reply	other threads:[~2022-12-15 20:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221215155534.1616b67a@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=irogers@google.com \
    --cc=linux-trace-devel@vger.kernel.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.