From 81604d43ade6abd316444f99ddb633f2e5a3f3eb Mon Sep 17 00:00:00 2001 From: Vasiliy Kulikov Date: Sun, 5 Sep 2010 22:32:33 +0400 Subject: [PATCH] staging: comedi: check return code of put_user Function put_user may fail. Check for it. Signed-off-by: Vasiliy Kulikov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 14091313cebb..98fa255d862e 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -537,7 +537,8 @@ static int do_chaninfo_ioctl(struct comedi_device *dev, x = (dev->minor << 28) | (it.subdev << 24) | (i << 16) | (s->range_table_list[i]->length); - put_user(x, it.rangelist + i); + if (put_user(x, it.rangelist + i)) + return -EFAULT; } #if 0 if (copy_to_user(it.rangelist, s->range_type_list,