Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325416
b: refs/heads/master
c: 95bc359
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Sep 19, 2012
1 parent 5ba4786 commit 6445ead
Show file tree
Hide file tree
Showing 2 changed files with 9 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: f8348677b1fffff801d5323db7ccadfdb2b290d0
refs/heads/master: 95bc359f98a077a5cfc34feb0a333d11a4124b1c
16 changes: 8 additions & 8 deletions trunk/drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1137,14 +1137,14 @@ static int do_cmd_ioctl(struct comedi_device *dev,
struct comedi_subdevice *s;
struct comedi_async *async;
int ret = 0;
unsigned int __user *chanlist_saver = NULL;
unsigned int __user *user_chanlist;

if (copy_from_user(&cmd, arg, sizeof(struct comedi_cmd))) {
DPRINTK("bad cmd address\n");
return -EFAULT;
}
/* save user's chanlist pointer so it can be restored later */
chanlist_saver = cmd.chanlist;
user_chanlist = (unsigned int __user *)cmd.chanlist;

if (cmd.subdev >= dev->n_subdevices) {
DPRINTK("%d no such subdevice\n", cmd.subdev);
Expand Down Expand Up @@ -1206,7 +1206,7 @@ static int do_cmd_ioctl(struct comedi_device *dev,
goto cleanup;
}

if (copy_from_user(async->cmd.chanlist, cmd.chanlist,
if (copy_from_user(async->cmd.chanlist, user_chanlist,
async->cmd.chanlist_len * sizeof(int))) {
DPRINTK("fault reading chanlist\n");
ret = -EFAULT;
Expand All @@ -1228,7 +1228,7 @@ static int do_cmd_ioctl(struct comedi_device *dev,
DPRINTK("test returned %d\n", ret);
cmd = async->cmd;
/* restore chanlist pointer before copying back */
cmd.chanlist = chanlist_saver;
cmd.chanlist = (unsigned int __force *)user_chanlist;
cmd.data = NULL;
if (copy_to_user(arg, &cmd, sizeof(struct comedi_cmd))) {
DPRINTK("fault writing cmd\n");
Expand Down Expand Up @@ -1287,14 +1287,14 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
struct comedi_subdevice *s;
int ret = 0;
unsigned int *chanlist = NULL;
unsigned int __user *chanlist_saver = NULL;
unsigned int __user *user_chanlist;

if (copy_from_user(&cmd, arg, sizeof(struct comedi_cmd))) {
DPRINTK("bad cmd address\n");
return -EFAULT;
}
/* save user's chanlist pointer so it can be restored later */
chanlist_saver = cmd.chanlist;
user_chanlist = (unsigned int __user *)cmd.chanlist;

if (cmd.subdev >= dev->n_subdevices) {
DPRINTK("%d no such subdevice\n", cmd.subdev);
Expand Down Expand Up @@ -1331,7 +1331,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
goto cleanup;
}

if (copy_from_user(chanlist, cmd.chanlist,
if (copy_from_user(chanlist, user_chanlist,
cmd.chanlist_len * sizeof(int))) {
DPRINTK("fault reading chanlist\n");
ret = -EFAULT;
Expand All @@ -1351,7 +1351,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
ret = s->do_cmdtest(dev, s, &cmd);

/* restore chanlist pointer before copying back */
cmd.chanlist = chanlist_saver;
cmd.chanlist = (unsigned int __force *)user_chanlist;

if (copy_to_user(arg, &cmd, sizeof(struct comedi_cmd))) {
DPRINTK("bad cmd address\n");
Expand Down

0 comments on commit 6445ead

Please sign in to comment.