diff mbox series

libtracefs: Remove unneeded check of !dynevent in dynevent_info()

Message ID 20221215155534.1616b67a@gandalf.local.home (mailing list archive)
State Accepted
Commit a053233c583fe3e7c53e99a233c3bfac0a828a3b
Headers show
Series libtracefs: Remove unneeded check of !dynevent in dynevent_info() | expand

Commit Message

Steven Rostedt Dec. 15, 2022, 8:55 p.m. UTC
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 mbox series

Patch

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]) {