]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
eventfs: Use ERR_CAST() in eventfs_create_events_dir()
authorNathan Chancellor <nathan@kernel.org>
Wed, 18 Oct 2023 18:10:31 +0000 (11:10 -0700)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 18 Oct 2023 18:20:17 +0000 (14:20 -0400)
commitb8a555dc31e5aa18d976de0bc228006e398a2e7d
tree50e78fcd905d5fcbef95f6b8000d31d72c761b8d
parent5ddd8baa4857709b4e5d84b376d735152851955b
eventfs: Use ERR_CAST() in eventfs_create_events_dir()

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