mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* lockdep: testing '0' where '\0' intended?
@ 2013-10-11 23:06 Roel Kluin
  2013-10-12 14:40 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2013-10-11 23:06 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, linux-kernel

Not entirely sure about the assembly part, but shouldn't it...
--------
Test for the nul character rather than the '0' (== 0x30), in the
__get_user_unknown() case.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c
index b2c71c5..71b3aba 100644
--- a/kernel/lockdep_proc.c
+++ b/kernel/lockdep_proc.c
@@ -632,7 +632,7 @@ static ssize_t lock_stat_write(struct file *file, 
const char __user *buf,
 		if (get_user(c, buf))
 			return -EFAULT;
 
-		if (c != '0')
+		if (c != '\0')
 			return count;
 
 		list_for_each_entry(class, &all_lock_classes, lock_entry)


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

* Re: lockdep: testing '0' where '\0' intended?
  2013-10-11 23:06 lockdep: testing '0' where '\0' intended? Roel Kluin
@ 2013-10-12 14:40 ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2013-10-12 14:40 UTC (permalink / raw)
  To: Roel Kluin; +Cc: Ingo Molnar, linux-kernel

On Sat, Oct 12, 2013 at 01:06:03AM +0200, Roel Kluin wrote:
> Not entirely sure about the assembly part, but shouldn't it...
> --------
> Test for the nul character rather than the '0' (== 0x30), in the
> __get_user_unknown() case.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c
> index b2c71c5..71b3aba 100644
> --- a/kernel/lockdep_proc.c
> +++ b/kernel/lockdep_proc.c
> @@ -632,7 +632,7 @@ static ssize_t lock_stat_write(struct file *file, 
> const char __user *buf,
>  		if (get_user(c, buf))
>  			return -EFAULT;
>  
> -		if (c != '0')
> +		if (c != '\0')

No we really meant '0'. Its so that:

  echo 0 > /proc/lock_stat

resets the stats.

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

end of thread, other threads:[~2013-10-12 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-11 23:06 lockdep: testing '0' where '\0' intended? Roel Kluin
2013-10-12 14:40 ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome