diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-10-30 18:03:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 20:37:30 -0500 |
commit | 8e8505be9c0ba608cbd634faa8fba361f17d2512 (patch) | |
tree | dcb75f543bb9b75b8c6bf0260f2b5f5283533c7e /drivers/char | |
parent | 7811fb8f400a3dbfa027d86bb583a31c66fddfc3 (diff) |
[PATCH] hpet: fix HPET_INFO calls from kernel space
Fix a wrong memory access in hpet_ioctl_common(). It was not possible to use
the HPET_INFO ioctl from kernel space because it always called copy_to_user().
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Cc: Bob Picco <bob.picco@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hpet.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 8e59639fb03c..c85d11de5feb 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -500,8 +500,12 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel) | |||
500 | readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK; | 500 | readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK; |
501 | info.hi_hpet = devp->hd_hpets->hp_which; | 501 | info.hi_hpet = devp->hd_hpets->hp_which; |
502 | info.hi_timer = devp - devp->hd_hpets->hp_dev; | 502 | info.hi_timer = devp - devp->hd_hpets->hp_dev; |
503 | if (copy_to_user((void __user *)arg, &info, sizeof(info))) | 503 | if (kernel) |
504 | err = -EFAULT; | 504 | memcpy((void *)arg, &info, sizeof(info)); |
505 | else | ||
506 | if (copy_to_user((void __user *)arg, &info, | ||
507 | sizeof(info))) | ||
508 | err = -EFAULT; | ||
505 | break; | 509 | break; |
506 | } | 510 | } |
507 | case HPET_EPI: | 511 | case HPET_EPI: |