From patchwork Fri Mar 1 20:08:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jann Horn X-Patchwork-Id: 10836089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3DE8180E for ; Fri, 1 Mar 2019 20:08:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E33322FDD8 for ; Fri, 1 Mar 2019 20:08:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D50B72FE8F; Fri, 1 Mar 2019 20:08:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B09F2FDD8 for ; Fri, 1 Mar 2019 20:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725996AbfCAUIr (ORCPT ); Fri, 1 Mar 2019 15:08:47 -0500 Received: from mail-it1-f202.google.com ([209.85.166.202]:60020 "EHLO mail-it1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbfCAUIr (ORCPT ); Fri, 1 Mar 2019 15:08:47 -0500 Received: by mail-it1-f202.google.com with SMTP id q192so12058998itb.9 for ; Fri, 01 Mar 2019 12:08:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=piSjA100sPG+ZVsc61tYlQG0rjYRR09SCBtuiXgjxhM=; b=bgxYSC/ehJ6FBNakJ0m5/tTf2KBxYaQpAzLKlwcy7jR1t80VFKrMwnNeDXlP3Z1nru 7m+n390IJB3XgiSo2r4Hh/kyGRpqiZrgaGdznj3XcNRPKZ+Uj70vplenlefyhyvQjNDy Q42LdCo/dgGa/Ad24E1/Ngk+rU03Ft0E2uJMPACRFycKWqTCS6gWCeUtKa689M1ob7qB 5Igjom7HBf1gkacMiwMGpO/37y/iJp/hs/UmBPv/7Bp/1rISvajWCk0YRGL6qrLvAVT6 J1ehvNA6IwiKyurA9aOmb/W8Pmi2Zfu8MpY0afQmf/YrguKdWc9xnkve7o9la1ICWI0v dGdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=piSjA100sPG+ZVsc61tYlQG0rjYRR09SCBtuiXgjxhM=; b=pQdGNWm3BdoQFnrZkv9M/fip+q9nVr01InX7Q8kFGHzWy5SnNR16+vxFI5sCyk/5wY gzw1tqjbPKP0hcVrUSzJkr8t45frJxPP4AZKPOdnXCeoyGYu5OPMVi56BkuB2CP8iBO2 UmRs7+BewoDum4HygQ+x+SBFIqZ38MyK677dueKhGqT/iY3Ps5YpcKPIF2xKELFe3R7e WGfrabld1VqD8rkfF2pTDjrVcqDob2+uEBIhMAM5lvsm0WK7mL1gxIMQvfA8XEPP5aGk gaTeC/qq3cWXXPdJ4T8T7cCOurWLuDwAHfCdT+WRkCl8SeQiKcrddSPW4aGLNfxzuKn3 5V6Q== X-Gm-Message-State: APjAAAVgVsrnDbbv2CIu7V0M/KlToy6KXEAXTNMkc/5B5E6PefdoiTrm PdnBWVit9wrPFqQ7XDDH0/Nij64wpw== X-Google-Smtp-Source: AHgI3IbWUIuiFA+Qg0y0EYTqXdZCBPzfYtTDj8A/+yAkITp6isykIvfFpC36+Aqq/49bvumggyZn60hgjw== X-Received: by 2002:a24:548:: with SMTP id 69mr4077709itl.29.1551470925977; Fri, 01 Mar 2019 12:08:45 -0800 (PST) Date: Fri, 1 Mar 2019 21:08:35 +0100 Message-Id: <20190301200835.18286-1-jannh@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.352.gf09ad66450-goog Subject: [PATCH] fs: use KERNEL_DS instead of get_ds() From: Jann Horn To: Alexander Viro , jannh@google.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);