| .. | .. |
|---|
| 877 | 877 | int (*test_sync)(struct kmod_test_device *test_dev)) |
|---|
| 878 | 878 | { |
|---|
| 879 | 879 | int ret; |
|---|
| 880 | | - unsigned long new; |
|---|
| 880 | + unsigned int val; |
|---|
| 881 | 881 | unsigned int old_val; |
|---|
| 882 | 882 | |
|---|
| 883 | | - ret = kstrtoul(buf, 10, &new); |
|---|
| 883 | + ret = kstrtouint(buf, 10, &val); |
|---|
| 884 | 884 | if (ret) |
|---|
| 885 | 885 | return ret; |
|---|
| 886 | | - |
|---|
| 887 | | - if (new > UINT_MAX) |
|---|
| 888 | | - return -EINVAL; |
|---|
| 889 | 886 | |
|---|
| 890 | 887 | mutex_lock(&test_dev->config_mutex); |
|---|
| 891 | 888 | |
|---|
| 892 | 889 | old_val = *config; |
|---|
| 893 | | - *(unsigned int *)config = new; |
|---|
| 890 | + *(unsigned int *)config = val; |
|---|
| 894 | 891 | |
|---|
| 895 | 892 | ret = test_sync(test_dev); |
|---|
| 896 | 893 | if (ret) { |
|---|
| .. | .. |
|---|
| 914 | 911 | unsigned int min, |
|---|
| 915 | 912 | unsigned int max) |
|---|
| 916 | 913 | { |
|---|
| 914 | + unsigned int val; |
|---|
| 917 | 915 | int ret; |
|---|
| 918 | | - unsigned long new; |
|---|
| 919 | 916 | |
|---|
| 920 | | - ret = kstrtoul(buf, 10, &new); |
|---|
| 917 | + ret = kstrtouint(buf, 10, &val); |
|---|
| 921 | 918 | if (ret) |
|---|
| 922 | 919 | return ret; |
|---|
| 923 | 920 | |
|---|
| 924 | | - if (new < min || new > max) |
|---|
| 921 | + if (val < min || val > max) |
|---|
| 925 | 922 | return -EINVAL; |
|---|
| 926 | 923 | |
|---|
| 927 | 924 | mutex_lock(&test_dev->config_mutex); |
|---|
| 928 | | - *config = new; |
|---|
| 925 | + *config = val; |
|---|
| 929 | 926 | mutex_unlock(&test_dev->config_mutex); |
|---|
| 930 | 927 | |
|---|
| 931 | 928 | /* Always return full write size even if we didn't consume all */ |
|---|
| .. | .. |
|---|
| 936 | 933 | const char *buf, size_t size, |
|---|
| 937 | 934 | int *config) |
|---|
| 938 | 935 | { |
|---|
| 936 | + int val; |
|---|
| 939 | 937 | int ret; |
|---|
| 940 | | - long new; |
|---|
| 941 | 938 | |
|---|
| 942 | | - ret = kstrtol(buf, 10, &new); |
|---|
| 939 | + ret = kstrtoint(buf, 10, &val); |
|---|
| 943 | 940 | if (ret) |
|---|
| 944 | 941 | return ret; |
|---|
| 945 | 942 | |
|---|
| 946 | | - if (new < INT_MIN || new > INT_MAX) |
|---|
| 947 | | - return -EINVAL; |
|---|
| 948 | | - |
|---|
| 949 | 943 | mutex_lock(&test_dev->config_mutex); |
|---|
| 950 | | - *config = new; |
|---|
| 944 | + *config = val; |
|---|
| 951 | 945 | mutex_unlock(&test_dev->config_mutex); |
|---|
| 952 | 946 | /* Always return full write size even if we didn't consume all */ |
|---|
| 953 | 947 | return size; |
|---|