xfs
[Top] [All Lists]

[PATCH 4/4] xfs: annotate user variables passed as void

To: xfs@xxxxxxxxxxx
Subject: [PATCH 4/4] xfs: annotate user variables passed as void
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 25 Sep 2014 09:37:43 +1000
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1411601863-19594-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1411601863-19594-1-git-send-email-david@xxxxxxxxxxxxx>
From: Dave Chinner <dchinner@xxxxxxxxxx>

Some argument callbacks can contain user buffers, and sparse warns
about passing them as void pointers. Cast appropriately to remove
the sparse warnings.

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
---
 fs/xfs/xfs_ioctl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 3799695..7a6b406 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1349,7 +1349,7 @@ xfs_ioc_setxflags(
 STATIC int
 xfs_getbmap_format(void **ap, struct getbmapx *bmv, int *full)
 {
-       struct getbmap __user   *base = *ap;
+       struct getbmap __user   *base = (struct getbmap __user *)*ap;
 
        /* copy only getbmap portion (not getbmapx) */
        if (copy_to_user(base, bmv, sizeof(struct getbmap)))
@@ -1380,7 +1380,7 @@ xfs_ioc_getbmap(
                bmx.bmv_iflags |= BMV_IF_NO_DMAPI_READ;
 
        error = xfs_getbmap(ip, &bmx, xfs_getbmap_format,
-                           (struct getbmap *)arg+1);
+                           (__force struct getbmap *)arg+1);
        if (error)
                return error;
 
@@ -1393,7 +1393,7 @@ xfs_ioc_getbmap(
 STATIC int
 xfs_getbmapx_format(void **ap, struct getbmapx *bmv, int *full)
 {
-       struct getbmapx __user  *base = *ap;
+       struct getbmapx __user  *base = (struct getbmapx __user *)*ap;
 
        if (copy_to_user(base, bmv, sizeof(struct getbmapx)))
                return -EFAULT;
@@ -1420,7 +1420,7 @@ xfs_ioc_getbmapx(
                return -EINVAL;
 
        error = xfs_getbmap(ip, &bmx, xfs_getbmapx_format,
-                           (struct getbmapx *)arg+1);
+                           (__force struct getbmapx *)arg+1);
        if (error)
                return error;
 
-- 
2.0.0

<Prev in Thread] Current Thread [Next in Thread>