ANDROID: Incremental fs: Use ERR_CAST in handle_mapped_file()
When building android-mainline with a version of clang that supports
CONFIG_RANDSTRUCT, there are errors about casts from randomized
structures to non-randomized structures:
fs/incfs/data_mgmt.c:240:10: error: casting from randomized structure pointer type 'struct dentry *' to 'struct data_file *'
return (struct data_file *)index_file_dentry;
^
fs/incfs/data_mgmt.c:257:12: error: casting from randomized structure pointer type 'struct file *' to 'struct data_file *'
result = (struct data_file *)bf;
^
2 errors generated.
As suggested by Kees on aosp/1995750, these casts should actually be
using the ERR_CAST macro, which is a more proper way to pass error
pointers around.
Change-Id: Iab73ac7503235f1147154a01a22ab8608e3daf8b
Fixes: 3f493810 ("ANDROID: Incremental fs: Create mapped file")
Link: https://github.com/ClangBuiltLinux/linux/issues/1652
Suggested-by:
Kees Cook <keescook@chromium.org>
Signed-off-by:
Nathan Chancellor <nathan@kernel.org>
Loading
Please sign in to comment