From: "Thomas Tuttle" <ttuttle@google.com>
To: mpm@selenic.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] pagemap: Make /proc/kpage{count,flags} return EINVAL (not EIO) on unaligned read.
Date: Thu, 5 Jun 2008 11:07:29 -0400 [thread overview]
Message-ID: <4ca0a85e0806050807v1ad0c309y75badc3fff7b796f@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 200 bytes --]
If a process tries to read at a position that's not a multiple of 8,
or for a count that's not a multiple of 8, they've passed an invalid
argument to read (for this file), so we should return EINVAL.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0004-Make-proc-kpage-count-flags-return-EINVAL-not-EIO.patch --]
[-- Type: text/x-patch; name=0004-Make-proc-kpage-count-flags-return-EINVAL-not-EIO.patch, Size: 1308 bytes --]
From f03729d3da3a7e38e3d8fba2826ea9dd88baaaf1 Mon Sep 17 00:00:00 2001
From: Thomas Tuttle <ttuttle@google.com>
Date: Thu, 5 Jun 2008 10:49:01 -0400
Subject: [PATCH] Make /proc/kpage{count,flags} return EINVAL (not EIO) on unaligned read.
This is what /proc/pid/pagemap does, and seems to make more sense, as the
error is really that the read had an invalid argument (location or size),
not that the underlying data could not be accessed.
Signed-off-by: Thomas Tuttle <ttuttle@google.com>
---
fs/proc/proc_misc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 5a16090..7e277f2 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -716,7 +716,7 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf,
pfn = src / KPMSIZE;
count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
if (src & KPMMASK || count & KPMMASK)
- return -EIO;
+ return -EINVAL;
while (count > 0) {
ppage = NULL;
@@ -782,7 +782,7 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf,
pfn = src / KPMSIZE;
count = min_t(unsigned long, count, (max_pfn * KPMSIZE) - src);
if (src & KPMMASK || count & KPMMASK)
- return -EIO;
+ return -EINVAL;
while (count > 0) {
ppage = NULL;
--
1.5.3.6
next reply other threads:[~2008-06-05 15:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-05 15:07 Thomas Tuttle [this message]
2008-06-05 16:24 ` Matt Mackall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ca0a85e0806050807v1ad0c309y75badc3fff7b796f@mail.gmail.com \
--to=ttuttle@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®