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

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.