xfs: don't open-code u64_to_user_ptr
authorDarrick J. Wong <djwong@kernel.org>
Wed, 22 May 2024 06:02:32 +0000 (23:02 -0700)
committerChandan Babu R <chandanbabu@kernel.org>
Mon, 27 May 2024 10:25:52 +0000 (15:55 +0530)
Don't open-code what the kernel already provides.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
fs/xfs/scrub/scrub.c
fs/xfs/xfs_handle.c

index c013f0ba4f36b2cfc9a3fe7c8131b14954fcc10a..4cbcf7a86dbec5920af6b2070d9e5e5e287225e8 100644 (file)
@@ -856,7 +856,7 @@ xfs_ioc_scrubv_metadata(
        if (vec_bytes > PAGE_SIZE)
                return -ENOMEM;
 
-       uvectors = (void __user *)(uintptr_t)head.svh_vectors;
+       uvectors = u64_to_user_ptr(head.svh_vectors);
        vectors = memdup_user(uvectors, vec_bytes);
        if (IS_ERR(vectors))
                return PTR_ERR(vectors);
index c8785ed595434223086affd3b0a71d18e25662bb..a3f16e9b6fe5b53baf7e75e6391435772d51044b 100644 (file)
@@ -773,11 +773,6 @@ xfs_getparents_expand_lastrec(
        trace_xfs_getparents_expand_lastrec(gpx->ip, gp, &gpx->context, gpr);
 }
 
-static inline void __user *u64_to_uptr(u64 val)
-{
-       return (void __user *)(uintptr_t)val;
-}
-
 /* Retrieve the parent pointers for a given inode. */
 STATIC int
 xfs_getparents(
@@ -862,7 +857,7 @@ xfs_getparents(
        ASSERT(gpx->context.firstu <= gpx->gph.gph_request.gp_bufsize);
 
        /* Copy the records to userspace. */
-       if (copy_to_user(u64_to_uptr(gpx->gph.gph_request.gp_buffer),
+       if (copy_to_user(u64_to_user_ptr(gpx->gph.gph_request.gp_buffer),
                                gpx->krecords, gpx->context.firstu))
                error = -EFAULT;