From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Kees Cook <keescook@chromium.org>,
Nathan Chancellor <nathan@kernel.org>
Subject: [for-next][PATCH 1/6] eventfs: Use ERR_CAST() in eventfs_create_events_dir()
Date: Fri, 20 Oct 2023 18:27:14 -0400 [thread overview]
Message-ID: <20231020222739.722516559@goodmis.org> (raw)
In-Reply-To: 20231020222713.074741220@goodmis.org
From: Nathan Chancellor <nathan@kernel.org>
When building with clang and CONFIG_RANDSTRUCT_FULL=y, there is an error
due to a cast in eventfs_create_events_dir():
fs/tracefs/event_inode.c:734:10: error: casting from randomized structure pointer type 'struct dentry *' to 'struct eventfs_inode *'
734 | return (struct eventfs_inode *)dentry;
| ^
1 error generated.
Use the ERR_CAST() function to resolve the error, as it was designed for
this exact situation (casting an error pointer to another type).
Link: https://lore.kernel.org/linux-trace-kernel/20231018-ftrace-fix-clang-randstruct-v1-1-338cb214abfb@kernel.org
Closes: https://github.com/ClangBuiltLinux/linux/issues/1947
Fixes: 5790b1fb3d67 ("eventfs: Remove eventfs_file and just use eventfs_inode")
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
fs/tracefs/event_inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index 1ccd100bc565..9f19b6608954 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -731,7 +731,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
return NULL;
if (IS_ERR(dentry))
- return (struct eventfs_inode *)dentry;
+ return ERR_CAST(dentry);
ei = kzalloc(sizeof(*ei), GFP_KERNEL);
if (!ei)
--
2.42.0
next prev parent reply other threads:[~2023-10-20 22:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 22:27 [for-next][PATCH 0/6] tracing: Updates for 6.7 Steven Rostedt
2023-10-20 22:27 ` Steven Rostedt [this message]
2023-10-20 22:27 ` [for-next][PATCH 2/6] eventfs: Fix failure path in eventfs_create_events_dir() Steven Rostedt
2023-10-20 22:27 ` [for-next][PATCH 3/6] tracing: Fix a NULL vs IS_ERR() bug in event_subsystem_dir() Steven Rostedt
2023-10-20 22:27 ` [for-next][PATCH 4/6] tracefs/eventfs: Modify mismatched function name Steven Rostedt
2023-10-20 22:27 ` [for-next][PATCH 5/6] tracing: Move readpos from seq_buf to trace_seq Steven Rostedt
2023-10-23 9:57 ` Andy Shevchenko
2023-10-23 14:43 ` Steven Rostedt
2023-10-20 22:27 ` [for-next][PATCH 6/6] seq_buf: fix a misleading comment 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=20231020222739.722516559@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=nathan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox