diff options
author | Dmitry Kasatkin <d.kasatkin@samsung.com> | 2014-11-05 17:01:17 +0200 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2014-11-17 23:14:22 -0500 |
commit | 6fb5032ebb1c5b852461d64ee33829081de8ca61 (patch) | |
tree | 1645235b1ff4461a8f67ed8fec24e0c15c64c614 /security/integrity | |
parent | c57782c13ecd7e7aca66cbf0139ad2a72317dc81 (diff) | |
download | linux-6fb5032ebb1c5b852461d64ee33829081de8ca61.tar.bz2 |
VFS: refactor vfs_read()
integrity_kernel_read() duplicates the file read operations code
in vfs_read(). This patch refactors vfs_read() code creating a
helper function __vfs_read(). It is used by both vfs_read() and
integrity_kernel_read().
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security/integrity')
-rw-r--r-- | security/integrity/iint.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/security/integrity/iint.c b/security/integrity/iint.c index df45640fbac6..dbb6d141c3db 100644 --- a/security/integrity/iint.c +++ b/security/integrity/iint.c @@ -184,20 +184,16 @@ int integrity_kernel_read(struct file *file, loff_t offset, { mm_segment_t old_fs; char __user *buf = (char __user *)addr; - ssize_t ret = -EINVAL; + ssize_t ret; if (!(file->f_mode & FMODE_READ)) return -EBADF; old_fs = get_fs(); set_fs(get_ds()); - if (file->f_op->read) - ret = file->f_op->read(file, buf, count, &offset); - else if (file->f_op->aio_read) - ret = do_sync_read(file, buf, count, &offset); - else if (file->f_op->read_iter) - ret = new_sync_read(file, buf, count, &offset); + ret = __vfs_read(file, buf, count, &offset); set_fs(old_fs); + return ret; } |