Skip to contentSkip to conversation

Sparse checks #1

Kernel-janitors Alexander Nyberg 1 participant 1 message Jun 15, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

All patches against current bk
this one much similar to Viro's work on drivers/block/floppy.c

Sparse checkings for drivers/block/floppy98.c

===== drivers/block/floppy98.c 1.17 vs edited =====

drivers/block/floppy98.c 2004-06-15 18:18:27 +02:00 renamed from drivers/block/floppy98.c 2004-05-22 10:23:01 +02:00 +10 -10
@@ -3120,18 +3120,18 @@
  * Misc Ioctl's and support
  * ========================
  */
-static inline int fd_copyout(void *param, const void *address, unsigned long size)
+static inline int fd_copyout(void __user *param, const void *address, unsigned long size)
 {
        return copy_to_user(param,address, size) ? -EFAULT : 0;
 }
 
-static inline int fd_copyin(void *param, void *address, unsigned long size)
+static inline int fd_copyin(void __user *param, void *address, unsigned long size)
 {
        return copy_from_user(address, param, size) ? -EFAULT : 0;
 }
 
-#define _COPYOUT(x) (copy_to_user((void *)param, &(x), sizeof(x)) ? -EFAULT : 0)
-#define _COPYIN(x) (copy_from_user(&(x), (void *)param, sizeof(x)) ? -EFAULT : 0)
+#define _COPYOUT(x) (copy_to_user((void __user *)param, &(x), sizeof(x)) ? -EFAULT : 0)
+#define _COPYIN(x) (copy_from_user(&(x), (void __user *)param, sizeof(x)) ? -EFAULT : 0)
 
 #define COPYOUT(x) ECALL(_COPYOUT(x))
 #define COPYIN(x) ECALL(_COPYIN(x))
@@ -3209,7 +3209,7 @@
        raw_cmd_done
 };
 
-static inline int raw_cmd_copyout(int cmd, char *param,
+static inline int raw_cmd_copyout(int cmd, char __user *param,
                                  struct floppy_raw_cmd *ptr)
 {
        int ret;
@@ -3249,7 +3249,7 @@
 }
 
 
-static inline int raw_cmd_copyin(int cmd, char *param,
+static inline int raw_cmd_copyin(int cmd, char __user *param,
                                 struct floppy_raw_cmd **rcmd)
 {
        struct floppy_raw_cmd *ptr;
@@ -3304,7 +3304,7 @@
 }
 
 
-static int raw_cmd_ioctl(int cmd, void *param)
+static int raw_cmd_ioctl(int cmd, void __user *param)
 {
        int drive, ret, ret2;
        struct floppy_raw_cmd *my_raw_cmd;
@@ -3551,7 +3551,7 @@
        /* copyin */
        CLEARSTRUCT(&inparam);
        if (_IOC_DIR(cmd) & _IOC_WRITE)
-               ECALL(fd_copyin((void *)param, &inparam, size))
+               ECALL(fd_copyin((void __user *)param, &inparam, size))
 
        switch (cmd) {
                case FDEJECT:
@@ -3671,7 +3671,7 @@
                                return -EINVAL;
                        LOCK_FDC(drive,1);
                        set_floppy(drive);
-                       CALL(i = raw_cmd_ioctl(cmd,(void *) param));
+                       CALL(i = raw_cmd_ioctl(cmd, (void __user *) param));
                        process_fd_request();
                        return i;
 
@@ -3686,7 +3686,7 @@
        }
 
        if (_IOC_DIR(cmd) & _IOC_READ)
-               return fd_copyout((void *)param, outparam, size);
+               return fd_copyout((void __user *)param, outparam, size);
        else
                return 0;
 #undef OUT

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors