Commit 95b19e2f authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Chandan Babu R

xfs: don't open-code u64_to_user_ptr

Don't open-code what the kernel already provides.
Signed-off-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
parent 38de5679
...@@ -856,7 +856,7 @@ xfs_ioc_scrubv_metadata( ...@@ -856,7 +856,7 @@ xfs_ioc_scrubv_metadata(
if (vec_bytes > PAGE_SIZE) if (vec_bytes > PAGE_SIZE)
return -ENOMEM; return -ENOMEM;
uvectors = (void __user *)(uintptr_t)head.svh_vectors; uvectors = u64_to_user_ptr(head.svh_vectors);
vectors = memdup_user(uvectors, vec_bytes); vectors = memdup_user(uvectors, vec_bytes);
if (IS_ERR(vectors)) if (IS_ERR(vectors))
return PTR_ERR(vectors); return PTR_ERR(vectors);
......
...@@ -773,11 +773,6 @@ xfs_getparents_expand_lastrec( ...@@ -773,11 +773,6 @@ xfs_getparents_expand_lastrec(
trace_xfs_getparents_expand_lastrec(gpx->ip, gp, &gpx->context, gpr); 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. */ /* Retrieve the parent pointers for a given inode. */
STATIC int STATIC int
xfs_getparents( xfs_getparents(
...@@ -862,7 +857,7 @@ xfs_getparents( ...@@ -862,7 +857,7 @@ xfs_getparents(
ASSERT(gpx->context.firstu <= gpx->gph.gph_request.gp_bufsize); ASSERT(gpx->context.firstu <= gpx->gph.gph_request.gp_bufsize);
/* Copy the records to userspace. */ /* 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)) gpx->krecords, gpx->context.firstu))
error = -EFAULT; error = -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment