verify_area() will soon be dead and gone, replaced by access_ok(), thus
the function named rw_verify_area() is badly named and should be renamed.
This patch renames rw_verify_area to rw_access_ok which seems more
appropriate (it also updates all callers of the functions as well as
references to it in comments).
Signed-off-by: Jesper Juhl <[email protected]>
---
arch/mips/kernel/linux32.c | 4 ++--
fs/compat.c | 2 +-
fs/locks.c | 2 +-
fs/read_write.c | 12 ++++++------
include/linux/fs.h | 2 +-
5 files changed, 11 insertions(+), 11 deletions(-)
--- linux-2.6.12-rc2-mm3-orig/fs/read_write.c 2005-04-11 21:20:51.000000000 +0200
+++ linux-2.6.12-rc2-mm3/fs/read_write.c 2005-04-17 23:39:14.000000000 +0200
@@ -183,7 +183,7 @@ bad:
#endif
-int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count)
+int rw_access_ok(int read_write, struct file *file, loff_t *ppos, size_t count)
{
struct inode *inode;
loff_t pos;
@@ -230,7 +230,7 @@ ssize_t vfs_read(struct file *file, char
if (unlikely(!access_ok(VERIFY_WRITE, buf, count)))
return -EFAULT;
- ret = rw_verify_area(READ, file, pos, count);
+ ret = rw_access_ok(READ, file, pos, count);
if (!ret) {
ret = security_file_permission (file, MAY_READ);
if (!ret) {
@@ -278,7 +278,7 @@ ssize_t vfs_write(struct file *file, con
if (unlikely(!access_ok(VERIFY_READ, buf, count)))
return -EFAULT;
- ret = rw_verify_area(WRITE, file, pos, count);
+ ret = rw_access_ok(WRITE, file, pos, count);
if (!ret) {
ret = security_file_permission (file, MAY_WRITE);
if (!ret) {
@@ -480,7 +480,7 @@ static ssize_t do_readv_writev(int type,
goto out;
}
- ret = rw_verify_area(type, file, pos, tot_len);
+ ret = rw_access_ok(type, file, pos, tot_len);
if (ret)
goto out;
@@ -633,7 +633,7 @@ static ssize_t do_sendfile(int out_fd, i
else
if (!(in_file->f_mode & FMODE_PREAD))
goto fput_in;
- retval = rw_verify_area(READ, in_file, ppos, count);
+ retval = rw_access_ok(READ, in_file, ppos, count);
if (retval)
goto fput_in;
@@ -654,7 +654,7 @@ static ssize_t do_sendfile(int out_fd, i
if (!out_file->f_op || !out_file->f_op->sendpage)
goto fput_out;
out_inode = out_file->f_dentry->d_inode;
- retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count);
+ retval = rw_access_ok(WRITE, out_file, &out_file->f_pos, count);
if (retval)
goto fput_out;
--- linux-2.6.12-rc2-mm3-orig/fs/compat.c 2005-04-11 21:20:50.000000000 +0200
+++ linux-2.6.12-rc2-mm3/fs/compat.c 2005-04-17 23:41:32.000000000 +0200
@@ -1190,7 +1190,7 @@ static ssize_t compat_do_readv_writev(in
goto out;
}
- ret = rw_verify_area(type, file, pos, tot_len);
+ ret = rw_access_ok(type, file, pos, tot_len);
if (ret)
goto out;
--- linux-2.6.12-rc2-mm3-orig/fs/locks.c 2005-04-05 21:21:43.000000000 +0200
+++ linux-2.6.12-rc2-mm3/fs/locks.c 2005-04-17 23:41:47.000000000 +0200
@@ -1018,7 +1018,7 @@ int locks_mandatory_locked(struct inode
* @count: length of area to check
*
* Searches the inode's list of locks to find any POSIX locks which conflict.
- * This function is called from rw_verify_area() and
+ * This function is called from rw_access_ok() and
* locks_verify_truncate().
*/
int locks_mandatory_area(int read_write, struct inode *inode,
--- linux-2.6.12-rc2-mm3-orig/arch/mips/kernel/linux32.c 2005-04-05 21:21:08.000000000 +0200
+++ linux-2.6.12-rc2-mm3/arch/mips/kernel/linux32.c 2005-04-17 23:42:03.000000000 +0200
@@ -468,7 +468,7 @@ asmlinkage ssize_t sys32_pread(unsigned
if (!(file->f_mode & FMODE_READ))
goto out;
pos = merge_64(a4, a5);
- ret = rw_verify_area(READ, file, &pos, count);
+ ret = rw_access_ok(READ, file, &pos, count);
if (ret)
goto out;
ret = -EINVAL;
@@ -503,7 +503,7 @@ asmlinkage ssize_t sys32_pwrite(unsigned
if (!(file->f_mode & FMODE_WRITE))
goto out;
pos = merge_64(a4, a5);
- ret = rw_verify_area(WRITE, file, &pos, count);
+ ret = rw_access_ok(WRITE, file, &pos, count);
if (ret)
goto out;
ret = -EINVAL;
--- linux-2.6.12-rc2-mm3-orig/include/linux/fs.h 2005-04-11 21:20:56.000000000 +0200
+++ linux-2.6.12-rc2-mm3/include/linux/fs.h 2005-04-17 23:42:13.000000000 +0200
@@ -1260,7 +1260,7 @@ static inline int locks_verify_locked(st
return 0;
}
-extern int rw_verify_area(int, struct file *, loff_t *, size_t);
+extern int rw_access_ok(int, struct file *, loff_t *, size_t);
static inline int locks_verify_truncate(struct inode *inode,
struct file *filp,
On Sun, Apr 17, 2005 at 11:50:35PM +0200, Jesper Juhl wrote:
> verify_area() will soon be dead and gone, replaced by access_ok(), thus
> the function named rw_verify_area() is badly named and should be renamed.
> This patch renames rw_verify_area to rw_access_ok which seems more
> appropriate (it also updates all callers of the functions as well as
> references to it in comments).
Not that I care too much, but, rw_verify_area() has nothing to do with
verify_area/access_ok functions.
I dont see real need to rename this function.
On Wed, 20 Apr 2005, Marcelo Tosatti wrote:
> On Sun, Apr 17, 2005 at 11:50:35PM +0200, Jesper Juhl wrote:
> > verify_area() will soon be dead and gone, replaced by access_ok(), thus
> > the function named rw_verify_area() is badly named and should be renamed.
> > This patch renames rw_verify_area to rw_access_ok which seems more
> > appropriate (it also updates all callers of the functions as well as
> > references to it in comments).
>
> Not that I care too much, but, rw_verify_area() has nothing to do with
> verify_area/access_ok functions.
>
right, access_ok deals with memory, rw_verify_area deals with files, but
both serve a similar purpose - validating access to a region. That's why I
thought it would make sense to have them named similarly (as they used to
be).
> I dont see real need to rename this function.
>
Perhaps I went a tad too far, or perhaps I misunderstood the point of
rw_verify_area(), that's certainly a possibility. In any case, it's no big
deal, I just thought it was the logical thing to do - I'll leave it in
Andrews capable hands to decide.
Thank you for commenting.
--
Jesper Juhl