Skip to contentSkip to conversation

proc: fix kflags to uflags copying in /proc/kpageflags

PATCH In review Wu Fengguang 2 participants 3 messages Mar 11, 2009 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proc: fix kflags to uflags copying in /proc/kpageflags

Fix kpf_copy_bit(src,dst) to be kpf_copy_bit(dst,src) to match the actual call patterns, e.g. kpf_copy_bit(kflags, KPF_LOCKED, PG_locked).

This misplacement of src/dst only affected reporting of PG_writeback, PG_reclaim and PG_buddy. For others kflags==uflags so not affected.

---

This is a tested and trivial no-side-effect fix. I'd suggest it for 2.6.29-rc7 and 2.6.28.X kernels.

fs/proc/page.c +1 -1
index 2d13451..e998383 100644
@@ -80,7 +80,7 @@ static const struct file_operations proc_kpagecount_operations = {
 #define KPF_RECLAIM    9
 #define KPF_BUDDY     10
 
-#define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
+#define kpf_copy_bit(flags, dstpos, srcpos) (((flags >> srcpos) & 1) << dstpos)
 
 static ssize_t kpageflags_read(struct file *file, char __user *buf,
 			     size_t count, loff_t *ppos)
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines

Fix kpf_copy_bit(src,dst) to be kpf_copy_bit(dst,src) to match the actual call patterns, e.g. kpf_copy_bit(kflags, KPF_LOCKED, PG_locked).

This misplacement of src/dst only affected reporting of PG_writeback, PG_reclaim and PG_buddy. For others kflags==uflags so not affected.

---

This is a tested and trivial no-side-effect fix. I'd suggest it for 2.6.29-rc7 and 2.6.28.X kernels.

fs/proc/page.c +0 -0
index 2d13451..e998383 100644

fs/proc/page.c static const struct file_operations proc_kpagecount_operations = { · line 83

Quoted 5 lines
fs/proc/page.c +1 -1
@@ -80,7 +80,7 @@ static const struct file_operations proc_kpagecount_operations = {
 #define KPF_RECLAIM    9
 #define KPF_BUDDY     10
 
-#define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
+#define kpf_copy_bit(flags, dstpos, srcpos) (((flags >> srcpos) & 1) << dstpos)

Good catch! :)

but don't worry. the number of this interface user is very few.

#2 lore raw
Quoted 20 lines · KOSAKI Motohiro
Quoted 20 lines

Fix kpf_copy_bit(src,dst) to be kpf_copy_bit(dst,src) to match the actual call patterns, e.g. kpf_copy_bit(kflags, KPF_LOCKED, PG_locked).

This misplacement of src/dst only affected reporting of PG_writeback, PG_reclaim and PG_buddy. For others kflags==uflags so not affected.

---

This is a tested and trivial no-side-effect fix. I'd suggest it for 2.6.29-rc7 and 2.6.28.X kernels.

fs/proc/page.c +0 -0
index 2d13451..e998383 100644
@@ -80,7 +80,7 @@ static const struct file_operations proc_kpagecount_operations = {
 #define KPF_RECLAIM    9
 #define KPF_BUDDY     10
 
Quoted 5 lines

fs/proc/page.c static const struct file_operations proc_kpagecount_operations = { · line 83

Quoted 2 lines
fs/proc/page.c +1 -1
-#define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
+#define kpf_copy_bit(flags, dstpos, srcpos) (((flags >> srcpos) & 1) << dstpos)

Good catch! :)

Thank you :)

Quoted 2 lines

but don't worry. the number of this interface user is very few.

Yeah, so few users that I have to write the tools by myself ;-)

Thanks,
Fengguang