Skip to content
Commit 0a84dbfe authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Andrew Morton
Browse files

fs/procfs: fix integer to pointer cast warning in do_procmap_query()

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 using u64_to_user_ptr() helper that's meant to handle this
properly.

Link: https://lkml.kernel.org/r/20240701174805.1897344-1-andrii@kernel.org


Fixes: df789ce1 ("fs/procfs: add build ID fetching to PROCMAP_QUERY API")
Fixes: 3757be49 ("fs/procfs: implement efficient VMA querying API for /proc/<pid>/maps")
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 9e4ecc4d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment