Commit a9cbeddd authored by Sergey Vlasov's avatar Sergey Vlasov Committed by Adrian Bunk

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: default avatarSergey Vlasov <vsu@altlinux.ru>
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
parent 89de5e72
...@@ -1310,20 +1310,22 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev ...@@ -1310,20 +1310,22 @@ 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) 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) 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; unsigned long value;
char *rest; char *rest;
value = simple_strtoul(buf, &rest, 10); value = simple_strtoul(buf, &rest, 10);
if (*rest) if (*rest)
return -EINVAL; return -EINVAL;
if ((unsigned int)value != value)
return -EINVAL;
*field = value; *field = value;
......
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