All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][BUGFIX] param: fix return value handling in param_set_*
@ 2011-05-26 23:38 Satoru Moriya
  2011-05-29  5:33 ` Rusty Russell
  0 siblings, 1 reply; 2+ messages in thread
From: Satoru Moriya @ 2011-05-26 23:38 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: rusty, Seiji Aguchi, dle-develop

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>
---
 kernel/params.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/params.c b/kernel/params.c
index ed72e13..2a4ba25 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -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;						\
 	}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][BUGFIX] param: fix return value handling in param_set_*
  2011-05-26 23:38 [PATCH][BUGFIX] param: fix return value handling in param_set_* Satoru Moriya
@ 2011-05-29  5:33 ` Rusty Russell
  0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2011-05-29  5:33 UTC (permalink / raw)
  To: Satoru Moriya, Linux Kernel Mailing List; +Cc: Seiji Aguchi, dle-develop

On Thu, 26 May 2011 19:38:04 -0400, Satoru Moriya <satoru.moriya@hds.com> wrote:
> 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>

Thanks, applied.

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-30  1:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-26 23:38 [PATCH][BUGFIX] param: fix return value handling in param_set_* Satoru Moriya
2011-05-29  5:33 ` Rusty Russell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.