Skip to content

Commit

Permalink
param: fix return value handling in param_set_*
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
Satoru Moriya authored and rustyrussell committed Jul 24, 2011
1 parent 6d6be43 commit 81c7413
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/params.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ int parse_args(const char *name,
int ret; \
\
ret = strtolfn(val, 0, &l); \
if (ret == -EINVAL || ((type)l != l)) \
return -EINVAL; \
if (ret < 0 || ((type)l != l)) \
return ret < 0 ? ret : -EINVAL; \
*((type *)kp->arg) = l; \
return 0; \
} \
Expand Down

0 comments on commit 81c7413

Please sign in to comment.