FORWARD: [PATCH] fs: use KERNEL_DS instead of get_ds()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




---------- Forwarded message ---------
From: Jann Horn <jannh@xxxxxxxxxx>
Date: Fri, Mar 1, 2019 at 12:08 PM
Subject: [PATCH] fs: use KERNEL_DS instead of get_ds()
To: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>, <jannh@xxxxxxxxxx>
Cc: <linux-fsdevel@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>


get_ds() is a legacy name for KERNEL_DS; all architectures #define it to
KERNEL_DS, and almost every user of set_fs() uses the name KERNEL_DS.

Let the VFS also use KERNEL_DS so that we can get rid of get_ds() at some
point.

Signed-off-by: Jann Horn <jannh@xxxxxxxxxx>
---
 fs/read_write.c | 6 +++---
 fs/splice.c     | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index ff3c5e6f87cf..30df848b7451 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -426,7 +426,7 @@ ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
        ssize_t result;

        old_fs = get_fs();
-       set_fs(get_ds());
+       set_fs(KERNEL_DS);
        /* The cast to a user pointer is valid due to the set_fs() */
        result = vfs_read(file, (void __user *)buf, count, pos);
        set_fs(old_fs);
@@ -499,7 +499,7 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t
                return -EINVAL;

        old_fs = get_fs();
-       set_fs(get_ds());
+       set_fs(KERNEL_DS);
        p = (__force const char __user *)buf;
        if (count > MAX_RW_COUNT)
                count =  MAX_RW_COUNT;
@@ -521,7 +521,7 @@ ssize_t kernel_write(struct file *file, const void *buf, size_t count,
        ssize_t res;

        old_fs = get_fs();
-       set_fs(get_ds());
+       set_fs(KERNEL_DS);
        /* The cast to a user pointer is valid due to the set_fs() */
        res = vfs_write(file, (__force const char __user *)buf, count, pos);
        set_fs(old_fs);
diff --git a/fs/splice.c b/fs/splice.c
index de2ede048473..ec8b54b5c0d2 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -357,7 +357,7 @@ static ssize_t kernel_readv(struct file *file, const struct kvec *vec,
        ssize_t res;

        old_fs = get_fs();
-       set_fs(get_ds());
+       set_fs(KERNEL_DS);
        /* The cast to a user pointer is valid due to the set_fs() */
        res = vfs_readv(file, (const struct iovec __user *)vec, vlen, &pos, 0);
        set_fs(old_fs);
--
2.21.0.352.gf09ad66450-goog

Ref: https://lkml.org/lkml/2019/3/1/643

-- 
Jose R R
http://metztli.it
---------------------------------------------------------------------------------------------
Download Metztli Reiser4: Debian Stretch w/ Linux 4.20 AMD64
---------------------------------------------------------------------------------------------
feats ZSTD compression https://sf.net/projects/metztli-reiser4/
-------------------------------------------------------------------------------------------
Official current Reiser4 resources: https://reiser4.wiki.kernel.org/



[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux