From: Min-Hua Chen <minhuadotchen@gmail.com>
Cc: Min-Hua Chen <minhuadotchen@gmail.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH] proc: fix casts to/from restricted fmode_t
Date: Sun, 22 Sep 2024 18:38:29 +0800 [thread overview]
Message-ID: <20240922103831.130355-1-minhuadotchen@gmail.com> (raw)
Peform a __force cast to fix the following sparse warnings:
fs/proc/base.c:2320:25: sparse: warning: cast to restricted fmode_t
fs/proc/base.c:2377:42: sparse: warning: cast from restricted fmode_t
fs/proc/base.c:2477:48: sparse: warning: cast from restricted fmode_t
No functional changes intended.
Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com>
---
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 b31283d81c52..cb32961dfb4a 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2317,7 +2317,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 = (__force fmode_t)(unsigned long)ptr;
struct proc_inode *ei;
struct inode *inode;
@@ -2374,7 +2374,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);
+ (void *)(__force unsigned long)vma->vm_file->f_mode);
out_no_vma:
mmap_read_unlock(mm);
@@ -2474,7 +2474,7 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx)
buf, len,
proc_map_files_instantiate,
task,
- (void *)(unsigned long)p->mode))
+ (void *)(__force unsigned long)p->mode))
break;
ctx->pos++;
}
--
2.43.0
reply other threads:[~2024-09-22 10:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240922103831.130355-1-minhuadotchen@gmail.com \
--to=minhuadotchen@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).