Skip to content

Commit 81c7413

Browse files
Satoru Moriyarustyrussell
authored andcommitted
param: fix return value handling in param_set_*
In STANDARD_PARAM_DEF, param_set_* handles the case in which strtolfn returns -EINVAL but it may return -ERANGE. If it returns -ERANGE, param_set_* may set uninitialized value to the paramerter. We should handle both cases. The one of the cases in which strtolfn() returns -ERANGE is following: *Type of module parameter is long *Set the parameter more than LONG_MAX Signed-off-by: Satoru Moriya <satoru.moriya@hds.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 6d6be43 commit 81c7413

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎kernel/params.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ int parse_args(const char *name,
225225
int ret; \
226226
\
227227
ret = strtolfn(val, 0, &l); \
228-
if (ret == -EINVAL || ((type)l != l)) \
229-
return -EINVAL; \
228+
if (ret < 0 || ((type)l != l)) \
229+
return ret < 0 ? ret : -EINVAL; \
230230
*((type *)kp->arg) = l; \
231231
return 0; \
232232
} \

0 commit comments

Comments
 (0)