Commit 8e8505be authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Linus Torvalds

[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: default avatarClemens Ladisch <clemens@ladisch.de>
Cc: Bob Picco <bob.picco@hp.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7811fb8f
...@@ -500,7 +500,11 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel) ...@@ -500,7 +500,11 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK; readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK;
info.hi_hpet = devp->hd_hpets->hp_which; info.hi_hpet = devp->hd_hpets->hp_which;
info.hi_timer = devp - devp->hd_hpets->hp_dev; info.hi_timer = devp - devp->hd_hpets->hp_dev;
if (copy_to_user((void __user *)arg, &info, sizeof(info))) if (kernel)
memcpy((void *)arg, &info, sizeof(info));
else
if (copy_to_user((void __user *)arg, &info,
sizeof(info)))
err = -EFAULT; err = -EFAULT;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment