aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/floppy.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 36cd33cbe44f..665b32f598cb 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -520,7 +520,6 @@ static DECLARE_WAIT_QUEUE_HEAD(command_done);
520 520
521#define NO_SIGNAL (!interruptible || !signal_pending(current)) 521#define NO_SIGNAL (!interruptible || !signal_pending(current))
522#define CALL(x) if ((x) == -EINTR) return -EINTR 522#define CALL(x) if ((x) == -EINTR) return -EINTR
523#define ECALL(x) if ((ret = (x))) return ret;
524#define _WAIT(x,i) CALL(ret=wait_til_done((x),i)) 523#define _WAIT(x,i) CALL(ret=wait_til_done((x),i))
525#define WAIT(x) _WAIT((x),interruptible) 524#define WAIT(x) _WAIT((x),interruptible)
526#define IWAIT(x) _WAIT((x),1) 525#define IWAIT(x) _WAIT((x),1)
@@ -3061,14 +3060,6 @@ static inline int fd_copyin(void __user *param, void *address,
3061 return copy_from_user(address, param, size) ? -EFAULT : 0; 3060 return copy_from_user(address, param, size) ? -EFAULT : 0;
3062} 3061}
3063 3062
3064#define _COPYOUT(x) (copy_to_user((void __user *)param, &(x), sizeof(x)) \
3065 ? -EFAULT : 0)
3066#define _COPYIN(x) (copy_from_user(&(x), (void __user *)param, sizeof(x)) \
3067 ? -EFAULT : 0)
3068
3069#define COPYOUT(x) ECALL(_COPYOUT(x))
3070#define COPYIN(x) ECALL(_COPYIN(x))
3071
3072static inline const char *drive_name(int type, int drive) 3063static inline const char *drive_name(int type, int drive)
3073{ 3064{
3074 struct floppy_struct *floppy; 3065 struct floppy_struct *floppy;
@@ -3145,7 +3136,9 @@ static inline int raw_cmd_copyout(int cmd, char __user *param,
3145 int ret; 3136 int ret;
3146 3137
3147 while (ptr) { 3138 while (ptr) {
3148 COPYOUT(*ptr); 3139 ret = copy_to_user((void __user *)param, ptr, sizeof(*ptr));
3140 if (ret)
3141 return -EFAULT;
3149 param += sizeof(struct floppy_raw_cmd); 3142 param += sizeof(struct floppy_raw_cmd);
3150 if ((ptr->flags & FD_RAW_READ) && ptr->buffer_length) { 3143 if ((ptr->flags & FD_RAW_READ) && ptr->buffer_length) {
3151 if (ptr->length >= 0 && 3144 if (ptr->length >= 0 &&
@@ -3195,7 +3188,9 @@ static inline int raw_cmd_copyin(int cmd, char __user *param,
3195 if (!ptr) 3188 if (!ptr)
3196 return -ENOMEM; 3189 return -ENOMEM;
3197 *rcmd = ptr; 3190 *rcmd = ptr;
3198 COPYIN(*ptr); 3191 ret = copy_from_user(ptr, (void __user *)param, sizeof(*ptr));
3192 if (ret)
3193 return -EFAULT;
3199 ptr->next = NULL; 3194 ptr->next = NULL;
3200 ptr->buffer_length = 0; 3195 ptr->buffer_length = 0;
3201 param += sizeof(struct floppy_raw_cmd); 3196 param += sizeof(struct floppy_raw_cmd);