* [PATCH] debugfs: Fix __rcu type comparison warning
@ 2023-09-22 13:45 Mike Tipton
2023-10-09 21:45 ` Georgi Djakov
0 siblings, 1 reply; 2+ messages in thread
From: Mike Tipton @ 2023-09-22 13:45 UTC (permalink / raw)
To: gregkh; +Cc: rafael, djakov, linux-kernel, Mike Tipton
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>
---
fs/debugfs/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 87b3753aa4b1..c45e8c2d62e1 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -939,7 +939,7 @@ static ssize_t debugfs_write_file_str(struct file *file, const char __user *user
new[pos + count] = '\0';
strim(new);
- rcu_assign_pointer(*(char **)file->private_data, new);
+ rcu_assign_pointer(*(char __rcu **)file->private_data, new);
synchronize_rcu();
kfree(old);
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] debugfs: Fix __rcu type comparison warning
2023-09-22 13:45 [PATCH] debugfs: Fix __rcu type comparison warning Mike Tipton
@ 2023-10-09 21:45 ` Georgi Djakov
0 siblings, 0 replies; 2+ messages in thread
From: Georgi Djakov @ 2023-10-09 21:45 UTC (permalink / raw)
To: Mike Tipton, gregkh; +Cc: rafael, linux-kernel
On 22.09.23 16:45, Mike Tipton wrote:
> 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>
Reviewed-by: Georgi Djakov <djakov@kernel.org>
> ---
> fs/debugfs/file.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
> index 87b3753aa4b1..c45e8c2d62e1 100644
> --- a/fs/debugfs/file.c
> +++ b/fs/debugfs/file.c
> @@ -939,7 +939,7 @@ static ssize_t debugfs_write_file_str(struct file *file, const char __user *user
> new[pos + count] = '\0';
> strim(new);
>
> - rcu_assign_pointer(*(char **)file->private_data, new);
> + rcu_assign_pointer(*(char __rcu **)file->private_data, new);
> synchronize_rcu();
> kfree(old);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-09 21:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-22 13:45 [PATCH] debugfs: Fix __rcu type comparison warning Mike Tipton
2023-10-09 21:45 ` Georgi Djakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®