aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/trackpoint.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mouse/trackpoint.c')
-rw-r--r--drivers/input/mouse/trackpoint.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
index 26b845fc186a..e68c814c4361 100644
--- a/drivers/input/mouse/trackpoint.c
+++ b/drivers/input/mouse/trackpoint.c
@@ -89,10 +89,8 @@ static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data,
89 struct trackpoint_attr_data *attr = data; 89 struct trackpoint_attr_data *attr = data;
90 unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); 90 unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset);
91 unsigned long value; 91 unsigned long value;
92 char *rest;
93 92
94 value = simple_strtoul(buf, &rest, 10); 93 if (strict_strtoul(buf, 10, &value) || value > 255)
95 if (*rest || value > 255)
96 return -EINVAL; 94 return -EINVAL;
97 95
98 *field = value; 96 *field = value;
@@ -117,10 +115,8 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data,
117 struct trackpoint_attr_data *attr = data; 115 struct trackpoint_attr_data *attr = data;
118 unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); 116 unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset);
119 unsigned long value; 117 unsigned long value;
120 char *rest;
121 118
122 value = simple_strtoul(buf, &rest, 10); 119 if (strict_strtoul(buf, 10, &value) || value > 1)
123 if (*rest || value > 1)
124 return -EINVAL; 120 return -EINVAL;
125 121
126 if (attr->inverted) 122 if (attr->inverted)