[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202310181114.55457CFE@keescook>
Date: Wed, 18 Oct 2023 11:14:22 -0700
From: Kees Cook <keescook@...omium.org>
To: Nathan Chancellor <nathan@...nel.org>
Cc: rostedt@...dmis.org, mhiramat@...nel.org, ndesaulniers@...gle.com,
trix@...hat.com, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, llvm@...ts.linux.dev,
patches@...ts.linux.dev
Subject: Re: [PATCH] eventfs: Use ERR_CAST() in eventfs_create_events_dir()
On Wed, Oct 18, 2023 at 11:10:31AM -0700, Nathan Chancellor wrote:
> 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).
>
> Closes: https://github.com/ClangBuiltLinux/linux/issues/1947
> Fixes: 5790b1fb3d67 ("eventfs: Remove eventfs_file and just use eventfs_inode")
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
Yes, please. That's the correct method to do such casts. Thanks!
Reviewed-by: Kees Cook <keescook@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists