mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pagemap: require aligned-length, non-null reads of /proc/pid/pagemap
@ 2009-04-20 14:58 Vitaly Mayatskikh
  0 siblings, 0 replies; only message in thread
From: Vitaly Mayatskikh @ 2009-04-20 14:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Thomas Tuttle, Andrew Morton

The intention of commit aae8679b0ebcaa92f99c1c3cb0cd651594a43915 was to
force reads of /proc/pid/pagemap to be a multiple of 8 bytes, but now it 
allows to read 0 bytes, which actually puts some data to user's buffer.
According to POSIX, if count is zero, read() should return zero and has
no other results.

Signed-off-by: Vitaly Mayatskikh <v.mayatskih@gmail.com>

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 39e4ad4..6f61b7c 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -665,6 +665,10 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
 		goto out_task;
 
 	ret = 0;
+
+	if (!count)
+		goto out_task;
+
 	mm = get_task_mm(task);
 	if (!mm)
 		goto out_task;

-- 
wbr, Vitaly

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-20 14:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-20 14:58 [PATCH] pagemap: require aligned-length, non-null reads of /proc/pid/pagemap Vitaly Mayatskikh

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

all inboxes | Powered by JetHome®