Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43430
b: refs/heads/master
c: 3c21cfc
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Drake authored and Stefan Richter committed Dec 7, 2006
1 parent b3e21ea commit cb79bba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c1c9c7cd9f33ad6ff4407638060fe2730560bd56
refs/heads/master: 3c21cfc4babaf4d20384f6f70def308e9b945159
18 changes: 10 additions & 8 deletions trunk/drivers/ieee1394/video1394.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,21 +884,22 @@ static int __video1394_ioctl(struct file *file,
struct dma_iso_ctx *d;
int next_prg;

if (copy_from_user(&v, argp, sizeof(v)))
if (unlikely(copy_from_user(&v, argp, sizeof(v))))
return -EFAULT;

d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, v.channel);
if (d == NULL) return -EFAULT;
if (unlikely(d == NULL))
return -EFAULT;

if ((v.buffer<0) || (v.buffer>=d->num_desc - 1)) {
if (unlikely((v.buffer<0) || (v.buffer>=d->num_desc - 1))) {
PRINT(KERN_ERR, ohci->host->id,
"Buffer %d out of range",v.buffer);
return -EINVAL;
}

spin_lock_irqsave(&d->lock,flags);

if (d->buffer_status[v.buffer]==VIDEO1394_BUFFER_QUEUED) {
if (unlikely(d->buffer_status[v.buffer]==VIDEO1394_BUFFER_QUEUED)) {
PRINT(KERN_ERR, ohci->host->id,
"Buffer %d is already used",v.buffer);
spin_unlock_irqrestore(&d->lock,flags);
Expand Down Expand Up @@ -949,13 +950,14 @@ static int __video1394_ioctl(struct file *file,
struct dma_iso_ctx *d;
int i = 0;

if (copy_from_user(&v, argp, sizeof(v)))
if (unlikely(copy_from_user(&v, argp, sizeof(v))))
return -EFAULT;

d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, v.channel);
if (d == NULL) return -EFAULT;
if (unlikely(d == NULL))
return -EFAULT;

if ((v.buffer<0) || (v.buffer>d->num_desc - 1)) {
if (unlikely((v.buffer<0) || (v.buffer>d->num_desc - 1))) {
PRINT(KERN_ERR, ohci->host->id,
"Buffer %d out of range",v.buffer);
return -EINVAL;
Expand Down Expand Up @@ -1008,7 +1010,7 @@ static int __video1394_ioctl(struct file *file,
spin_unlock_irqrestore(&d->lock, flags);

v.buffer=i;
if (copy_to_user(argp, &v, sizeof(v)))
if (unlikely(copy_to_user(argp, &v, sizeof(v))))
return -EFAULT;

return 0;
Expand Down

0 comments on commit cb79bba

Please sign in to comment.