Skip to contentSkip to conversation

lockdep: testing '0' where '\0' intended?

PATCH Roel Kluin 2 participants 2 messages Oct 11, 2013 – Oct 12, 2013

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

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.

---

kernel/lockdep_proc.c +0 -0
index b2c71c5..71b3aba 100644
@@ -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)

#1 lore raw
Quoted 12 lines · Roel Kluin

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.

---

kernel/lockdep_proc.c +0 -0
index b2c71c5..71b3aba 100644

kernel/lockdep_proc.c static ssize_t lock_stat_write(struct file *file, · line 636

Quoted 6 lines
kernel/lockdep_proc.c +1 -1
@@ -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.