Messages in this thread | | | Date | Wed, 18 Oct 2023 11:14:22 -0700 | From | Kees Cook <> | 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@kernel.org>
Yes, please. That's the correct method to do such casts. Thanks!
Reviewed-by: Kees Cook <keescook@chromium.org>
-- Kees Cook
| |