Skip to content

Commit 95b19e2

Browse files
Darrick J. WongChandan Babu R
authored andcommitted
xfs: don't open-code u64_to_user_ptr
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>
1 parent 38de567 commit 95b19e2

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

fs/xfs/scrub/scrub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ xfs_ioc_scrubv_metadata(
856856
if (vec_bytes > PAGE_SIZE)
857857
return -ENOMEM;
858858

859-
uvectors = (void __user *)(uintptr_t)head.svh_vectors;
859+
uvectors = u64_to_user_ptr(head.svh_vectors);
860860
vectors = memdup_user(uvectors, vec_bytes);
861861
if (IS_ERR(vectors))
862862
return PTR_ERR(vectors);

fs/xfs/xfs_handle.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -773,11 +773,6 @@ xfs_getparents_expand_lastrec(
773773
trace_xfs_getparents_expand_lastrec(gpx->ip, gp, &gpx->context, gpr);
774774
}
775775

776-
static inline void __user *u64_to_uptr(u64 val)
777-
{
778-
return (void __user *)(uintptr_t)val;
779-
}
780-
781776
/* Retrieve the parent pointers for a given inode. */
782777
STATIC int
783778
xfs_getparents(
@@ -862,7 +857,7 @@ xfs_getparents(
862857
ASSERT(gpx->context.firstu <= gpx->gph.gph_request.gp_bufsize);
863858

864859
/* Copy the records to userspace. */
865-
if (copy_to_user(u64_to_uptr(gpx->gph.gph_request.gp_buffer),
860+
if (copy_to_user(u64_to_user_ptr(gpx->gph.gph_request.gp_buffer),
866861
gpx->krecords, gpx->context.firstu))
867862
error = -EFAULT;
868863

0 commit comments

Comments
 (0)