struct file_ctx *ctx = (struct file_ctx *)file->private_data;
struct ti_ohci *ohci = ctx->ohci;
unsigned long flags;
+ void __user *argp = (void __user *)arg;
switch(cmd)
{
struct dma_iso_ctx *d;
int i;
- if (copy_from_user(&v, (void *)arg, sizeof(v)))
+ if (copy_from_user(&v, argp, sizeof(v)))
return -EFAULT;
/* if channel < 0, find lowest available one */
v.channel);
}
- if (copy_to_user((void *)arg, &v, sizeof(v)))
+ if (copy_to_user(argp, &v, sizeof(v)))
return -EFAULT;
return 0;
u64 mask;
struct dma_iso_ctx *d;
- if (copy_from_user(&channel, (void *)arg, sizeof(int)))
+ if (copy_from_user(&channel, argp, sizeof(int)))
return -EFAULT;
if (channel<0 || channel>(ISO_CHANNELS-1)) {
struct video1394_wait v;
struct dma_iso_ctx *d;
- if (copy_from_user(&v, (void *)arg, sizeof(v)))
+ if (copy_from_user(&v, argp, sizeof(v)))
return -EFAULT;
d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, v.channel);
struct dma_iso_ctx *d;
int i;
- if (copy_from_user(&v, (void *)arg, sizeof(v)))
+ if (copy_from_user(&v, argp, sizeof(v)))
return -EFAULT;
d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, v.channel);
spin_unlock_irqrestore(&d->lock, flags);
v.buffer=i;
- if (copy_to_user((void *)arg, &v, sizeof(v)))
+ if (copy_to_user(argp, &v, sizeof(v)))
return -EFAULT;
return 0;
case VIDEO1394_IOC_TALK_QUEUE_BUFFER:
{
struct video1394_wait v;
- struct video1394_queue_variable qv;
+ unsigned int *psizes = NULL;
struct dma_iso_ctx *d;
- qv.packet_sizes = NULL;
-
- if (copy_from_user(&v, (void *)arg, sizeof(v)))
+ if (copy_from_user(&v, argp, sizeof(v)))
return -EFAULT;
d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, v.channel);
}
if (d->flags & VIDEO1394_VARIABLE_PACKET_SIZE) {
- unsigned int *psizes;
int buf_size = d->nb_cmd * sizeof(unsigned int);
+ struct video1394_queue_variable __user *p = argp;
+ unsigned int __user *qv;
- if (copy_from_user(&qv, (void *)arg, sizeof(qv)))
+ if (get_user(qv, &p->packet_sizes))
return -EFAULT;
psizes = kmalloc(buf_size, GFP_KERNEL);
if (!psizes)
return -ENOMEM;
- if (copy_from_user(psizes, qv.packet_sizes, buf_size)) {
+ if (copy_from_user(psizes, qv, buf_size)) {
kfree(psizes);
return -EFAULT;
}
-
- qv.packet_sizes = psizes;
}
spin_lock_irqsave(&d->lock,flags);
PRINT(KERN_ERR, ohci->host->id,
"Buffer %d is already used",v.buffer);
spin_unlock_irqrestore(&d->lock,flags);
- if (qv.packet_sizes)
- kfree(qv.packet_sizes);
+ if (psizes)
+ kfree(psizes);
return -EFAULT;
}
if (d->flags & VIDEO1394_VARIABLE_PACKET_SIZE) {
initialize_dma_it_prg_var_packet_queue(
- d, v.buffer, qv.packet_sizes,
+ d, v.buffer, psizes,
ohci);
}
}
}
- if (qv.packet_sizes)
- kfree(qv.packet_sizes);
+ if (psizes)
+ kfree(psizes);
return 0;
struct video1394_wait v;
struct dma_iso_ctx *d;
- if (copy_from_user(&v, (void *)arg, sizeof(v)))
+ if (copy_from_user(&v, argp, sizeof(v)))
return -EFAULT;
d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, v.channel);
static int video1394_wr_wait32(unsigned int fd, unsigned int cmd, unsigned long arg,
struct file *file)
{
+ struct video1394_wait32 __user *argp = (void __user *)arg;
struct video1394_wait32 wait32;
struct video1394_wait wait;
mm_segment_t old_fs;
if (file->f_op->ioctl != video1394_ioctl)
return -EFAULT;
- if (copy_from_user(&wait32, (void *)arg, sizeof(wait32)))
+ if (copy_from_user(&wait32, argp, sizeof(wait32)))
return -EFAULT;
wait.channel = wait32.channel;
wait32.filltime.tv_sec = (int)wait.filltime.tv_sec;
wait32.filltime.tv_usec = (int)wait.filltime.tv_usec;
- if (copy_to_user((struct video1394_wait32 *)arg, &wait32, sizeof(wait32)))
+ if (copy_to_user(argp, &wait32, sizeof(wait32)))
ret = -EFAULT;
}
if (file->f_op->ioctl != video1394_ioctl)
return -EFAULT;
- if (copy_from_user(&wait32, (void *)arg, sizeof(wait32)))
+ if (copy_from_user(&wait32, (void __user *)arg, sizeof(wait32)))
return -EFAULT;
wait.channel = wait32.channel;