From: Andrii Nakryiko <andrii@kernel.org>
To: linux-mm@kvack.org, akpm@linux-foundation.org
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
adobriyan@gmail.com, Andrii Nakryiko <andrii@kernel.org>,
Stephen Rothwell <sfr@canb.auug.org.au>
Subject: [PATCH] fs/procfs: fix integer to pointer cast warning in do_procmap_query()
Date: Sun, 30 Jun 2024 18:23:48 -0700 [thread overview]
Message-ID: <20240701012348.2409471-1-andrii@kernel.org> (raw)
On 32-bit architectures compiler will complain about casting __u64 to
void * pointer:
fs/proc/task_mmu.c: In function 'do_procmap_query':
fs/proc/task_mmu.c:598:48: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
598 | if (karg.vma_name_size && copy_to_user((void __user *)karg.vma_name_addr,
| ^
fs/proc/task_mmu.c:605:48: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
605 | if (karg.build_id_size && copy_to_user((void __user *)karg.build_id_addr,
| ^
Fix this by adding intermediate cast to uintptr_t.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: df789ce1eb90 ("fs/procfs: add build ID fetching to PROCMAP_QUERY API")
Fixes: 3757be498749 ("fs/procfs: implement efficient VMA querying API for /proc/<pid>/maps")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
fs/proc/task_mmu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index d99a390a0f41..e11d6197cef5 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -595,14 +595,14 @@ static int do_procmap_query(struct proc_maps_private *priv, void __user *uarg)
query_vma_teardown(mm, vma);
mmput(mm);
- if (karg.vma_name_size && copy_to_user((void __user *)karg.vma_name_addr,
+ if (karg.vma_name_size && copy_to_user((void __user *)(uintptr_t)karg.vma_name_addr,
name, karg.vma_name_size)) {
kfree(name_buf);
return -EFAULT;
}
kfree(name_buf);
- if (karg.build_id_size && copy_to_user((void __user *)karg.build_id_addr,
+ if (karg.build_id_size && copy_to_user((void __user *)(uintptr_t)karg.build_id_addr,
build_id_buf, karg.build_id_size))
return -EFAULT;
--
2.43.0
reply other threads:[~2024-07-01 1:23 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=20240701012348.2409471-1-andrii@kernel.org \
--to=andrii@kernel.org \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sfr@canb.auug.org.au \
/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).