summaryrefslogtreecommitdiff
path: root/drivers/input/mouse/psmouse-base.c
diff options
context:
space:
mode:
authorSergey Vlasov <vsu@altlinux.ru>2006-11-09 00:34:27 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-09 00:34:27 -0500
commiteb5d5829b368c5e32f248a70797bee5a414a2ef0 (patch)
tree5c65bfd305a720f0d9802f4a086a09e129091b91 /drivers/input/mouse/psmouse-base.c
parent721556150e397f606a3f029736d77a27503f94e2 (diff)
Input: psmouse - fix attribute access on 64-bit systems
psmouse_show_int_attr() and psmouse_set_int_attr() were accessing unsigned int fields as unsigned long, which gave garbage on x86_64. Signed-off-by: Sergey Vlasov <vsu@altlinux.ru> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/psmouse-base.c')
-rw-r--r--drivers/input/mouse/psmouse-base.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 9144df65e703..58beca99a9c3 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1349,14 +1349,14 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev
static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char *buf)
{
- unsigned long *field = (unsigned long *)((char *)psmouse + (size_t)offset);
+ unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset);
- return sprintf(buf, "%lu\n", *field);
+ return sprintf(buf, "%u\n", *field);
}
static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count)
{
- unsigned long *field = (unsigned long *)((char *)psmouse + (size_t)offset);
+ unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset);
unsigned long value;
char *rest;
@@ -1364,6 +1364,9 @@ static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const
if (*rest)
return -EINVAL;
+ if ((unsigned int)value != value)
+ return -EINVAL;
+
*field = value;
return count;