From patchwork Fri Jun 28 00:38:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 13715334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63420C30653 for ; Fri, 28 Jun 2024 00:38:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E3F016B00A0; Thu, 27 Jun 2024 20:38:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DEE886B00A1; Thu, 27 Jun 2024 20:38:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB6A86B00A2; Thu, 27 Jun 2024 20:38:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id AFD5D6B00A0 for ; Thu, 27 Jun 2024 20:38:19 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 639511A135D for ; Fri, 28 Jun 2024 00:38:19 +0000 (UTC) X-FDA: 82278435918.04.4522B5D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf10.hostedemail.com (Postfix) with ESMTP id 41A2EC0002 for ; Fri, 28 Jun 2024 00:38:17 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dRVP6jZh; spf=pass (imf10.hostedemail.com: domain of sandeen@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=sandeen@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719535087; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=29Ula9NPUYU9ZHKXK1TTET3Q7YUfe5/KhwenbSdyx5g=; b=BiTKmI4fTt7kLE01xjkZAskC5EkPYvmikPWF77fep3SUHe2thqcWRqfm9ewdwIhF6ppL3f 5qxq3w3aAuSReaJWyCVOqbGQlcWZxXC5MNKH9kZdbgfmqakOuAa+ObZP6b1nygnWwCrDrw mixEaJkeuU2VfpX8trrTihNTeAOO/MY= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dRVP6jZh; spf=pass (imf10.hostedemail.com: domain of sandeen@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=sandeen@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719535087; a=rsa-sha256; cv=none; b=QvRsJzW83xb6k1xtNMeFXenetHh73Q7nYz/P6p+fFmdtOPv3iwMehPqSO1Ew/+qFy1fUnp l8xHIE8T6LjMDUcnA6tNnI7dvsVkywAB4Q4NmJkkJFz72GIIjOfldMGxC+Uk++0eamwmBb KMLZpyWfYJB1T1DmpZ/Z5kC1OEtgN3E= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719535096; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=29Ula9NPUYU9ZHKXK1TTET3Q7YUfe5/KhwenbSdyx5g=; b=dRVP6jZhTpLgwBH0yJC9+ZiPccW5i5sY9keGdfU4l2tHolc1VCwc1W5jjdtP8FJbWrJFni ZaPBlO4zZP+njnAYWNNL7rJIQPhZpvUL/5i4znw+fs5LVOyGaDz+iEjebq/+VRLdDFmAn+ 6Us4+VzmderRDo7TByq5uBjCVpvM0ns= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-35-9N8QDIJmM4-4QsufrOwFaw-1; Thu, 27 Jun 2024 20:38:13 -0400 X-MC-Unique: 9N8QDIJmM4-4QsufrOwFaw-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-7f3c8b1fee1so5312039f.0 for ; Thu, 27 Jun 2024 17:38:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719535093; x=1720139893; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=29Ula9NPUYU9ZHKXK1TTET3Q7YUfe5/KhwenbSdyx5g=; b=xO44YiLbJnlGQG8koDDmP++nA2m3xkEh9bWj/KWVlnaEivzNpNW69KZ0CQtSIvrfBH Ynr8XUa64CIe00bwomCGUknlXVpClFZVQtxQ7VU1ZQnyGUZmDoqmWlSMmxzO3sez1tBM fxKhJ4yLqLusgyHuAqAcLX0625/1blEyeYF5juLqgU7x+k1Ab6DAa4i1e7aJPuEDSHn4 MupjXoYjq1knWkb76Er5H4MnQ58c9hplk+SXmZNO7t9cLWqiXkSLasSgu6gv5xyeF289 pMP8FSbYYz4D3MXN0N/6z72swIDA30Ic/9mBJSuABCP4PA/TAW7+qyJDWLtJ6s73vKrz 6vWw== X-Gm-Message-State: AOJu0Yxrdbv9XNxKaSnMzg7hETPtUMJLD/DJZ1sLJYZMrmCTdUmC2AEE bqZBeIqKVS6hTflNhmPqku9JZNZW0PSkktAPzs3TT3pKhl0yupJ42P2vlFXPETh9H/i7vrFRT7o b1tn25W+/HyJiHguVd5KKhx9D8PYNROCiqifttaG01rVRSgvx X-Received: by 2002:a05:6602:1648:b0:7eb:8887:d6c3 with SMTP id ca18e2360f4ac-7f3a4dda0d6mr1937224039f.11.1719535093148; Thu, 27 Jun 2024 17:38:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxqgFVI3k6X0qAOuP2yi+58eeC72Sq6ILbNqb+MthMIuCOYIhyyBK37gEipr9eZhFvFHZE7A== X-Received: by 2002:a05:6602:1648:b0:7eb:8887:d6c3 with SMTP id ca18e2360f4ac-7f3a4dda0d6mr1937223139f.11.1719535092889; Thu, 27 Jun 2024 17:38:12 -0700 (PDT) Received: from [10.0.0.71] (sandeen.net. [63.231.237.45]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4bb73bba7c0sm226668173.16.2024.06.27.17.38.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 17:38:12 -0700 (PDT) Message-ID: <06b54c7c-4f08-4d99-93d1-32b9f6706209@redhat.com> Date: Thu, 27 Jun 2024 19:38:12 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 11/14] tmpfs: Convert to new uid/gid option parsing helpers From: Eric Sandeen To: linux-fsdevel@vger.kernel.org, Christian Brauner Cc: linux-mm@kvack.org References: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> In-Reply-To: <8dca3c11-99f4-446d-a291-35c50ed2dc14@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 41A2EC0002 X-Stat-Signature: d47qk4x9fgo1ocrpfr8dozijds3tqw4k X-Rspam-User: X-HE-Tag: 1719535097-457630 X-HE-Meta: U2FsdGVkX19aXpzHbdw2DnHZg3UoVULWyfmsDtzP+pRjpwxhDs0z65UNCsqG12dIw9tZnSmDkYmuab9D1jGSPY4XPNWMoVcwZlDmJBAD+Y1jDMTm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bWUz5ijN2UklRf8r1gatxj1Cn/TMSMwHVuOUelnX1v8i8kjQl9p20PuLrP57Pzly00ZZWSwWkvg0TWunFgcjjUhBrF+9vjaEJXzRGWwEHiNFkysIdWfg4Sxr8eNHzMzUqY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen --- mm/shmem.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index a8b181a63402..922204184a82 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3903,14 +3903,14 @@ static const struct constant_table shmem_param_enums_huge[] = { }; const struct fs_parameter_spec shmem_fs_parameters[] = { - fsparam_u32 ("gid", Opt_gid), + fsparam_gid ("gid", Opt_gid), fsparam_enum ("huge", Opt_huge, shmem_param_enums_huge), fsparam_u32oct("mode", Opt_mode), fsparam_string("mpol", Opt_mpol), fsparam_string("nr_blocks", Opt_nr_blocks), fsparam_string("nr_inodes", Opt_nr_inodes), fsparam_string("size", Opt_size), - fsparam_u32 ("uid", Opt_uid), + fsparam_uid ("uid", Opt_uid), fsparam_flag ("inode32", Opt_inode32), fsparam_flag ("inode64", Opt_inode64), fsparam_flag ("noswap", Opt_noswap), @@ -3970,9 +3970,7 @@ static int shmem_parse_one(struct fs_context *fc, struct fs_parameter *param) ctx->mode = result.uint_32 & 07777; break; case Opt_uid: - kuid = make_kuid(current_user_ns(), result.uint_32); - if (!uid_valid(kuid)) - goto bad_value; + kuid = result.uid; /* * The requested uid must be representable in the @@ -3984,9 +3982,7 @@ static int shmem_parse_one(struct fs_context *fc, struct fs_parameter *param) ctx->uid = kuid; break; case Opt_gid: - kgid = make_kgid(current_user_ns(), result.uint_32); - if (!gid_valid(kgid)) - goto bad_value; + kgid = result.gid; /* * The requested gid must be representable in the