[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7761c3fd-4fb5-1d65-c2e6-044d689de6b6@openvz.org>
Date: Mon, 23 May 2022 06:37:29 +0300
From: Vasily Averin <vvs@...nvz.org>
To: Matthew Wilcox <willy@...radead.org>
Cc: kernel@...nvz.org, linux-kernel@...r.kernel.org,
Christoph Hellwig <hch@...radead.org>,
Christian Brauner <brauner@...nel.org>,
Jan Kara <jack@...e.cz>, linux-fsdevel@...r.kernel.org
Subject: [PATCH v4] fs/proc/base.c: fix incorrect fmode_t casts
Fixes sparce warnings:
fs/proc/base.c:2240:25: sparse: warning: cast to restricted fmode_t
fs/proc/base.c:2297:42: sparse: warning: cast from restricted fmode_t
fs/proc/base.c:2394:48: sparse: warning: cast from restricted fmode_t
fmode_t is birwie type and requires __force attribute for any cast
Signed-off-by: Vasily Averin <vvs@...nvz.org>
Reviewed-by: Christoph Hellwig <hch@....de>
---
v4: improved according to Matthew Wilcox's hint
v3: split, reworked according to Christoph Hellwig recommendation
---
fs/proc/base.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index c1031843cc6a..89521d3fc456 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2237,7 +2237,7 @@ static struct dentry *
proc_map_files_instantiate(struct dentry *dentry,
struct task_struct *task, const void *ptr)
{
- fmode_t mode = (fmode_t)(unsigned long)ptr;
+ fmode_t mode = *(fmode_t *)ptr;
struct proc_inode *ei;
struct inode *inode;
@@ -2294,7 +2294,7 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
if (vma->vm_file)
result = proc_map_files_instantiate(dentry, task,
- (void *)(unsigned long)vma->vm_file->f_mode);
+ &vma->vm_file->f_mode);
out_no_vma:
mmap_read_unlock(mm);
@@ -2391,7 +2391,7 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx)
buf, len,
proc_map_files_instantiate,
task,
- (void *)(unsigned long)p->mode))
+ &p->mode))
break;
ctx->pos++;
}
--
2.36.1
Powered by blists - more mailing lists