* [PATCH 3/4] pagemap: Return EINVAL, not EIO, for unaligned reads of kpagecount or kpageflags (v2 of series)
@ 2008-06-05 18:40 Thomas Tuttle
2008-06-05 18:49 ` Matt Mackall
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Tuttle @ 2008-06-05 18:40 UTC (permalink / raw)
To: mpm, akpm, linux-kernel
If the user tries to read from a position that is not a multiple of 8, or
read a number of bytes that is not a multiple of 8, they have passed an
invalid argument to read, for the purpose of reading these files. It's
not an IO error because we didn't encounter any trouble finding the data
they asked for.
Signed-off-by: Thomas Tuttle
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 3/4] pagemap: Return EINVAL, not EIO, for unaligned reads of kpagecount or kpageflags (v2 of series)
2008-06-05 18:40 [PATCH 3/4] pagemap: Return EINVAL, not EIO, for unaligned reads of kpagecount or kpageflags (v2 of series) Thomas Tuttle
@ 2008-06-05 18:49 ` Matt Mackall
0 siblings, 0 replies; 2+ messages in thread
From: Matt Mackall @ 2008-06-05 18:49 UTC (permalink / raw)
To: Thomas Tuttle; +Cc: akpm, linux-kernel
On Thu, 2008-06-05 at 14:40 -0400, Thomas Tuttle wrote:
> If the user tries to read from a position that is not a multiple of 8, or
> read a number of bytes that is not a multiple of 8, they have passed an
> invalid argument to read, for the purpose of reading these files. It's
> not an IO error because we didn't encounter any trouble finding the data
> they asked for.
Hmm. I seem to recall choosing EIO because that's what unaligned reads
with direct I/O report. I don't particularly care though.
Acked-by: Matt Mackall <mpm@selenic.com>
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-05 18:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-05 18:40 [PATCH 3/4] pagemap: Return EINVAL, not EIO, for unaligned reads of kpagecount or kpageflags (v2 of series) Thomas Tuttle
2008-06-05 18:49 ` Matt Mackall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox