aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/psmouse-base.c
diff options
context:
space:
mode:
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
1349 1349
1350static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char *buf) 1350static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char *buf)
1351{ 1351{
1352 unsigned long *field = (unsigned long *)((char *)psmouse + (size_t)offset); 1352 unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset);
1353 1353
1354 return sprintf(buf, "%lu\n", *field); 1354 return sprintf(buf, "%u\n", *field);
1355} 1355}
1356 1356
1357static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count) 1357static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count)
1358{ 1358{
1359 unsigned long *field = (unsigned long *)((char *)psmouse + (size_t)offset); 1359 unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset);
1360 unsigned long value; 1360 unsigned long value;
1361 char *rest; 1361 char *rest;
1362 1362
@@ -1364,6 +1364,9 @@ static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const
1364 if (*rest) 1364 if (*rest)
1365 return -EINVAL; 1365 return -EINVAL;
1366 1366
1367 if ((unsigned int)value != value)
1368 return -EINVAL;
1369
1367 *field = value; 1370 *field = value;
1368 1371
1369 return count; 1372 return count;