Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

debugfs: Fix __rcu type comparison warning

Sparse reports the following:

fs/debugfs/file.c:942:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
fs/debugfs/file.c:942:9: sparse: char [noderef] __rcu *
fs/debugfs/file.c:942:9: sparse: char *

rcu_assign_pointer() expects that it's assigning to pointers annotated
with __rcu. We can't annotate the generic struct file::private_data, so
cast it instead.

Fixes: 86b5488121db ("debugfs: Add write support to debugfs_create_str()")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202309091933.BRWlSnCq-lkp@intel.com/
Signed-off-by: Mike Tipton <quic_mdtipton@quicinc.com>
Link: https://lore.kernel.org/r/20230922134512.5126-1-quic_mdtipton@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mike Tipton and committed by
Greg Kroah-Hartman
7360a48b 1dc05a27

+1 -1
+1 -1
fs/debugfs/file.c
··· 939 939 new[pos + count] = '\0'; 940 940 strim(new); 941 941 942 - rcu_assign_pointer(*(char **)file->private_data, new); 942 + rcu_assign_pointer(*(char __rcu **)file->private_data, new); 943 943 synchronize_rcu(); 944 944 kfree(old); 945 945