@@ -1305,15 +1305,19 @@ static ssize_t atkbd_show_extra(struct atkbd *atkbd, char *buf)
13051305static ssize_t atkbd_set_extra (struct atkbd * atkbd , const char * buf , size_t count )
13061306{
13071307 struct input_dev * old_dev , * new_dev ;
1308- unsigned long value ;
1308+ unsigned int value ;
13091309 int err ;
13101310 bool old_extra ;
13111311 unsigned char old_set ;
13121312
13131313 if (!atkbd -> write )
13141314 return - EIO ;
13151315
1316- if (strict_strtoul (buf , 10 , & value ) || value > 1 )
1316+ err = kstrtouint (buf , 10 , & value );
1317+ if (err )
1318+ return err ;
1319+
1320+ if (value > 1 )
13171321 return - EINVAL ;
13181322
13191323 if (atkbd -> extra != value ) {
@@ -1389,11 +1393,15 @@ static ssize_t atkbd_show_scroll(struct atkbd *atkbd, char *buf)
13891393static ssize_t atkbd_set_scroll (struct atkbd * atkbd , const char * buf , size_t count )
13901394{
13911395 struct input_dev * old_dev , * new_dev ;
1392- unsigned long value ;
1396+ unsigned int value ;
13931397 int err ;
13941398 bool old_scroll ;
13951399
1396- if (strict_strtoul (buf , 10 , & value ) || value > 1 )
1400+ err = kstrtouint (buf , 10 , & value );
1401+ if (err )
1402+ return err ;
1403+
1404+ if (value > 1 )
13971405 return - EINVAL ;
13981406
13991407 if (atkbd -> scroll != value ) {
@@ -1433,15 +1441,19 @@ static ssize_t atkbd_show_set(struct atkbd *atkbd, char *buf)
14331441static ssize_t atkbd_set_set (struct atkbd * atkbd , const char * buf , size_t count )
14341442{
14351443 struct input_dev * old_dev , * new_dev ;
1436- unsigned long value ;
1444+ unsigned int value ;
14371445 int err ;
14381446 unsigned char old_set ;
14391447 bool old_extra ;
14401448
14411449 if (!atkbd -> write )
14421450 return - EIO ;
14431451
1444- if (strict_strtoul (buf , 10 , & value ) || (value != 2 && value != 3 ))
1452+ err = kstrtouint (buf , 10 , & value );
1453+ if (err )
1454+ return err ;
1455+
1456+ if (value != 2 && value != 3 )
14451457 return - EINVAL ;
14461458
14471459 if (atkbd -> set != value ) {
@@ -1484,14 +1496,18 @@ static ssize_t atkbd_show_softrepeat(struct atkbd *atkbd, char *buf)
14841496static ssize_t atkbd_set_softrepeat (struct atkbd * atkbd , const char * buf , size_t count )
14851497{
14861498 struct input_dev * old_dev , * new_dev ;
1487- unsigned long value ;
1499+ unsigned int value ;
14881500 int err ;
14891501 bool old_softrepeat , old_softraw ;
14901502
14911503 if (!atkbd -> write )
14921504 return - EIO ;
14931505
1494- if (strict_strtoul (buf , 10 , & value ) || value > 1 )
1506+ err = kstrtouint (buf , 10 , & value );
1507+ if (err )
1508+ return err ;
1509+
1510+ if (value > 1 )
14951511 return - EINVAL ;
14961512
14971513 if (atkbd -> softrepeat != value ) {
@@ -1534,11 +1550,15 @@ static ssize_t atkbd_show_softraw(struct atkbd *atkbd, char *buf)
15341550static ssize_t atkbd_set_softraw (struct atkbd * atkbd , const char * buf , size_t count )
15351551{
15361552 struct input_dev * old_dev , * new_dev ;
1537- unsigned long value ;
1553+ unsigned int value ;
15381554 int err ;
15391555 bool old_softraw ;
15401556
1541- if (strict_strtoul (buf , 10 , & value ) || value > 1 )
1557+ err = kstrtouint (buf , 10 , & value );
1558+ if (err )
1559+ return err ;
1560+
1561+ if (value > 1 )
15421562 return - EINVAL ;
15431563
15441564 if (atkbd -> softraw != value ) {
0 commit comments