mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
pagemap: return EINVAL, not EIO, for unaligned reads of kpagecount or kpageflags
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 <[email protected]> Cc: Matt Mackall <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
bbcdac0c20
commit
4710d1ac4c
1 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue