Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp885243pxb; Wed, 27 Oct 2021 14:27:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyi3OqRoVALwcYl+woLBCcRBuWE5jYj7bIQz5fvkkxlH1oaKKNrDCnPbtWiEwx0rdjRL0Lf X-Received: by 2002:a05:6402:1911:: with SMTP id e17mr518379edz.62.1635370060727; Wed, 27 Oct 2021 14:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370060; cv=none; d=google.com; s=arc-20160816; b=qQJBWRZM35FlbyyXucjz0klNvwsrRl8Jko+yZC9zUHXShGDwD4MeHCiZnut0Qo/50m rQ1L19E8VGO6dN1CKY51ny4Qyg28mxPBsJXD1YsgNdlmuX96fBNSrl+NR4QC5QflVc0O 7oCjH5G1uBjrYcQ8uNDATgOoFP53SRAnqmu1Qp/pvUPNjyveqeJNegDL7glRheT77w5X 8grNJBbDU2ITUKt9FPyqfH7y8UvKVyP9Ex59j6nwTJFEmL6gdo5pzSh0arvAZ6wCf56K +UFWtUtbnO/y3r2eKMko4QkBiJjFq1/guo9t6vnAMSuq3WzOiofC4J9Vb8GExetowRW4 ELjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EzpF32Y2Kh2ZzUQaOCru6WXIMfUYuG9RUH2BNfpH+Bk=; b=D15NMT3EUdR1DlZAUSy5xrHki+H8bj1JfXEUa/Uur+aefQxuvrzj54ppGjRWawOfB+ u4tEPIQyXl+YiWE6h8NS23jYKwTad6WRHFvbsD4WZDdtDwZMYR3lchFJl65efzVpbuql OAvOybM3JzzTswH9EmyozsJpmlZ0WuXizAnxrEa3BI36XR+Z21J61pzrz2gmYonWAypL axbjOaB6xSgUFihmJDRd5pCTpJQbKN55ltxzPUkhufx9YKq/d4MRxeZveGYAUo7MuL2A 8ujsTa2IkQ4JTPrsQYdElP/yYHqn76ZgabZzIzvGwxYc1J2RRNqRgAIZBDBJLIPtjJDk PZaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YjbbNIrK; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qb29si1639941ejc.678.2021.10.27.14.27.17; Wed, 27 Oct 2021 14:27:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YjbbNIrK; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242483AbhJ0OVu (ORCPT + 99 others); Wed, 27 Oct 2021 10:21:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:33730 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242491AbhJ0OVp (ORCPT ); Wed, 27 Oct 2021 10:21:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635344359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EzpF32Y2Kh2ZzUQaOCru6WXIMfUYuG9RUH2BNfpH+Bk=; b=YjbbNIrKRQsSPMRbS1O8vPRmvArACd1culeRg4acXia/QyKBx21hI9NT2Zo+f5LBSSydTk vzBc6Q9NEjF7NwD61XYWpdNIJhffjI2Mg/KIkG/UCH6lQYcPsqTqCX7k17HeYBsisRt0QC zdCVLh3N+hxWxF4feFOKRtX6HFUWgw8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-7-VfUoCqaMPeKgvU2pJ1SJHg-1; Wed, 27 Oct 2021 10:19:18 -0400 X-MC-Unique: VfUoCqaMPeKgvU2pJ1SJHg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F3BC11005547; Wed, 27 Oct 2021 14:19:16 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFF595DF35; Wed, 27 Oct 2021 14:19:15 +0000 (UTC) From: Lukas Czerner To: linux-ext4@vger.kernel.org, tytso@mit.edu Cc: linux-fsdevel@vger.kernel.org, Carlos Maiolino Subject: [PATCH v4 03/13] ext4: move option validation to a separate function Date: Wed, 27 Oct 2021 16:18:47 +0200 Message-Id: <20211027141857.33657-4-lczerner@redhat.com> In-Reply-To: <20211027141857.33657-1-lczerner@redhat.com> References: <20211027141857.33657-1-lczerner@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Move option validation out of parse_options() into a separate function ext4_validate_options(). Signed-off-by: Lukas Czerner Reviewed-by: Carlos Maiolino --- fs/ext4/super.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 42f4a3741692..5f6ad0615a2a 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -87,6 +87,7 @@ static void ext4_unregister_li_request(struct super_block *sb); static void ext4_clear_request_list(void); static struct inode *ext4_get_journal_inode(struct super_block *sb, unsigned int journal_inum); +static int ext4_validate_options(struct super_block *sb); /* * Lock ordering @@ -2575,10 +2576,9 @@ static int parse_options(char *options, struct super_block *sb, struct ext4_parsed_options *ret_opts, int is_remount) { - struct ext4_sb_info __maybe_unused *sbi = EXT4_SB(sb); - char *p, __maybe_unused *usr_qf_name, __maybe_unused *grp_qf_name; substring_t args[MAX_OPT_ARGS]; int token; + char *p; if (!options) return 1; @@ -2596,7 +2596,14 @@ static int parse_options(char *options, struct super_block *sb, is_remount) < 0) return 0; } + return ext4_validate_options(sb); +} + +static int ext4_validate_options(struct super_block *sb) +{ + struct ext4_sb_info *sbi = EXT4_SB(sb); #ifdef CONFIG_QUOTA + char *usr_qf_name, *grp_qf_name; /* * We do the test below only for project quotas. 'usrquota' and * 'grpquota' mount options are allowed even without quota feature -- 2.31.1