linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] dynamic_debug: remove wrong error message
@ 2014-01-23 13:20 Andrey Ryabinin
  2014-01-23 13:20 ` [PATCH 2/3] dynamic_debug: fix ddebug_parse_query() Andrey Ryabinin
  2014-01-23 13:20 ` [PATCH 3/3] dynamic_debug: replace obselete simple_strtoul() with kstrtouint() Andrey Ryabinin
  0 siblings, 2 replies; 5+ messages in thread
From: Andrey Ryabinin @ 2014-01-23 13:20 UTC (permalink / raw)
  To: Jason Baron; +Cc: linux-kernel, Andrey Ryabinin

parse_lineno() returns either negative error code or zero.
We don't need to print something here because if parse_lineno
fails it will print error message.

Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
---
 lib/dynamic_debug.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 600ac57..f959c39 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -348,10 +348,8 @@ static int ddebug_parse_query(char *words[], int nwords,
 			}
 			if (last)
 				*last++ = '\0';
-			if (parse_lineno(first, &query->first_lineno) < 0) {
-				pr_err("line-number is <0\n");
+			if (parse_lineno(first, &query->first_lineno) < 0)
 				return -EINVAL;
-			}
 			if (last) {
 				/* range <first>-<last> */
 				if (parse_lineno(last, &query->last_lineno)
-- 
1.8.3.2


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

* [PATCH 2/3] dynamic_debug: fix ddebug_parse_query()
  2014-01-23 13:20 [PATCH 1/3] dynamic_debug: remove wrong error message Andrey Ryabinin
@ 2014-01-23 13:20 ` Andrey Ryabinin
  2014-01-23 13:20 ` [PATCH 3/3] dynamic_debug: replace obselete simple_strtoul() with kstrtouint() Andrey Ryabinin
  1 sibling, 0 replies; 5+ messages in thread
From: Andrey Ryabinin @ 2014-01-23 13:20 UTC (permalink / raw)
  To: Jason Baron; +Cc: linux-kernel, Andrey Ryabinin

This fixes following scenario:

$ echo 'file dynamic_debug.c line 1-123 +p' > /sys/kernel/debug/dynamic_debug/control
-bash: echo: write error: Invalid argument
$ dmesg | grep dynamic_debug
dynamic_debug:ddebug_parse_query: last-line:123 < 1st-line:1
dynamic_debug:ddebug_parse_query: query parse failed

Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
---
 lib/dynamic_debug.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index f959c39..e488d9a 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -352,8 +352,10 @@ static int ddebug_parse_query(char *words[], int nwords,
 				return -EINVAL;
 			if (last) {
 				/* range <first>-<last> */
-				if (parse_lineno(last, &query->last_lineno)
-				    < query->first_lineno) {
+				if (parse_lineno(last, &query->last_lineno) < 0)
+					return -EINVAL;
+
+				if (query->last_lineno < query->first_lineno) {
 					pr_err("last-line:%d < 1st-line:%d\n",
 						query->last_lineno,
 						query->first_lineno);
-- 
1.8.3.2


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

* [PATCH 3/3] dynamic_debug: replace obselete simple_strtoul() with kstrtouint()
  2014-01-23 13:20 [PATCH 1/3] dynamic_debug: remove wrong error message Andrey Ryabinin
  2014-01-23 13:20 ` [PATCH 2/3] dynamic_debug: fix ddebug_parse_query() Andrey Ryabinin
@ 2014-01-23 13:20 ` Andrey Ryabinin
  2014-01-24 20:03   ` Jason Baron
  1 sibling, 1 reply; 5+ messages in thread
From: Andrey Ryabinin @ 2014-01-23 13:20 UTC (permalink / raw)
  To: Jason Baron; +Cc: linux-kernel, Andrey Ryabinin

Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
---
 lib/dynamic_debug.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index e488d9a..7288e38 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -268,14 +268,12 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
  */
 static inline int parse_lineno(const char *str, unsigned int *val)
 {
-	char *end = NULL;
 	BUG_ON(str == NULL);
 	if (*str == '\0') {
 		*val = 0;
 		return 0;
 	}
-	*val = simple_strtoul(str, &end, 10);
-	if (end == NULL || end == str || *end != '\0') {
+	if (kstrtouint(str, 10, val) < 0) {
 		pr_err("bad line-number: %s\n", str);
 		return -EINVAL;
 	}
-- 
1.8.3.2


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

* Re: [PATCH 3/3] dynamic_debug: replace obselete simple_strtoul() with kstrtouint()
  2014-01-23 13:20 ` [PATCH 3/3] dynamic_debug: replace obselete simple_strtoul() with kstrtouint() Andrey Ryabinin
@ 2014-01-24 20:03   ` Jason Baron
  2014-01-24 21:35     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Baron @ 2014-01-24 20:03 UTC (permalink / raw)
  To: Andrey Ryabinin, gregkh; +Cc: linux-kernel

Hi,

I think we want some sort of commit message for this patch. But they
all look good to me and they tested fine.

Acked-by: Jason Baron <jbaron@akamai.com>

Greg, Can you pick up this series?

Thanks,

-Jason

On 01/23/2014 08:20 AM, Andrey Ryabinin wrote:
> Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
> ---
>  lib/dynamic_debug.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index e488d9a..7288e38 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -268,14 +268,12 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
>   */
>  static inline int parse_lineno(const char *str, unsigned int *val)
>  {
> -	char *end = NULL;
>  	BUG_ON(str == NULL);
>  	if (*str == '\0') {
>  		*val = 0;
>  		return 0;
>  	}
> -	*val = simple_strtoul(str, &end, 10);
> -	if (end == NULL || end == str || *end != '\0') {
> +	if (kstrtouint(str, 10, val) < 0) {
>  		pr_err("bad line-number: %s\n", str);
>  		return -EINVAL;
>  	}


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

* Re: [PATCH 3/3] dynamic_debug: replace obselete simple_strtoul() with kstrtouint()
  2014-01-24 20:03   ` Jason Baron
@ 2014-01-24 21:35     ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2014-01-24 21:35 UTC (permalink / raw)
  To: Jason Baron; +Cc: Andrey Ryabinin, linux-kernel

On Fri, Jan 24, 2014 at 03:03:38PM -0500, Jason Baron wrote:
> Hi,
> 
> I think we want some sort of commit message for this patch. But they
> all look good to me and they tested fine.
> 
> Acked-by: Jason Baron <jbaron@akamai.com>
> 
> Greg, Can you pick up this series?

Will do, after 3.14-rc1 is out, thanks.

greg k-h

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

end of thread, other threads:[~2014-01-24 21:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-23 13:20 [PATCH 1/3] dynamic_debug: remove wrong error message Andrey Ryabinin
2014-01-23 13:20 ` [PATCH 2/3] dynamic_debug: fix ddebug_parse_query() Andrey Ryabinin
2014-01-23 13:20 ` [PATCH 3/3] dynamic_debug: replace obselete simple_strtoul() with kstrtouint() Andrey Ryabinin
2014-01-24 20:03   ` Jason Baron
2014-01-24 21:35     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).