Let's start treating "arg" as a user pointer instead of an unsigned long earlier so we can remove some ugly casts. diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 2cc43a724554..5caf53942604 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -506,7 +506,8 @@ vchiq_ioc_queue_message(VCHIQ_SERVICE_HANDLE_T handle, &context, total_size); } -static int vchiq_ioctl_create_service(struct file *file, unsigned int cmd, unsigned long arg) +static int vchiq_ioctl_create_service(struct file *file, unsigned int cmd, + VCHIQ_CREATE_SERVICE_T __user *uargs) { VCHIQ_INSTANCE_T instance = file->private_data; VCHIQ_STATUS_T status = VCHIQ_SUCCESS; @@ -516,7 +517,7 @@ static int vchiq_ioctl_create_service(struct file *file, unsigned int cmd, unsig void *userdata; int srvstate; - if (copy_from_user(&args, (const void __user *)arg, sizeof(args))) + if (copy_from_user(&args, uargs, sizeof(args))) return -EFAULT; user_service = kmalloc(sizeof(*user_service), GFP_KERNEL); @@ -568,9 +569,8 @@ static int vchiq_ioctl_create_service(struct file *file, unsigned int cmd, unsig } } - if (copy_to_user((void __user *) - &(((VCHIQ_CREATE_SERVICE_T __user *)arg)->handle), - &service->handle, sizeof(service->handle))) { + if (copy_to_user(&uargs->handle, &service->handle, + sizeof(service->handle))) { vchiq_remove_service(service->handle); return -EFAULT; } @@ -649,7 +649,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) break; case VCHIQ_IOC_CREATE_SERVICE: - return vchiq_ioctl_create_service(file, cmd, arg); + return vchiq_ioctl_create_service(file, cmd, + (void __user *)arg); case VCHIQ_IOC_CLOSE_SERVICE: { VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg; _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel