From patchwork Fri Dec 1 14:30:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?G=C3=BCnther_Noack?= X-Patchwork-Id: 13475908 X-Patchwork-Delegate: paul@paul-moore.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="36RM7FnR" Received: from mail-wr1-x44a.google.com (mail-wr1-x44a.google.com [IPv6:2a00:1450:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29B6E10FC for ; Fri, 1 Dec 2023 06:30:52 -0800 (PST) Received: by mail-wr1-x44a.google.com with SMTP id ffacd0b85a97d-333127fecf9so1612978f8f.2 for ; Fri, 01 Dec 2023 06:30:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701441050; x=1702045850; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:from:to:cc:subject:date :message-id:reply-to; bh=+VI7T8R5MvFXTSB1Rg3Eq481TAOlvF5CgtwOKqX0AD0=; b=36RM7FnRDawgkuo60ITl9rWAup2I6BCG1bn6T+HPmsIxyDcItJdH/TqowmBlhvijn/ NS3BR2zIW1cmJSCRBXHoDSNGUTcD2Z4oLRfmJy5smHRCptQZkXiyom+34vbhyTJYU6Uq 63XMR57PA8Sgum94iICHUBvuXPQduZfEZ5j/Tjqc7ZaUeg4DJvJFC9ucZjDuqAgbskx7 griMqTjviX5RErzccKcOXtoSyYSoEQGhnyjg8YsVfSM9u1fMyUv2LgNXpOIU5V8EPnzE EZtWD/D3U9LiPvgPcv6u5MTfO3cZqMMFkxisq85P2j0FYrPP01db3RMshmzI1hrwAiPd C16g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701441050; x=1702045850; h=content-transfer-encoding:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=+VI7T8R5MvFXTSB1Rg3Eq481TAOlvF5CgtwOKqX0AD0=; b=A2lnnJ2/tJRYeVvs1/yVOnByTfcP3bvfo+k9+RQF395a7xnmCDEv0JHi7DHhk9wDqh pE3sMdcBuDbjiLtcLl/yXmNTCrQqVOr1yDCzYDRkgt4g/tSy4myUXnBrheeDY2dP4S8n bLPAtHqa+vfvvSXdz9HfGEB0VIvezKjyTp0IU9/bmuJS701C5ZcEgrXazDkEegd6/6c6 VyKIZaJHKc3pXhDTMCFwb4OhfkI+wAD6y+b/xg1Zfkc80DQ8iyXlSYYwG7ZagRqgCTjM MbdEeZEW+BvB6hIkj1MPddramqNEXIfZIqkediZDlSZK+2+EpIJ5s9gZLd+/9HrW+Qhn BLuQ== X-Gm-Message-State: AOJu0YxkdehjdXZn3lYdC8sO6gok0psq4eGj5nTZP9AiX7wGKyPDGLrE NdIfhs9p+aAPv9YANAY1mIYM0osY5gCQ0xXJDJfrRqKXE8w5p+FgtshkrrPpkqjI/IPoK0I1Js6 0uZfvWkRQImemOfG10ACbmSJHk6f1IOcvY11L71w0hjHX192Jq/k5ZQcscfvgr+dTutF7EabInY lMZVpZWQ== X-Google-Smtp-Source: AGHT+IF0CIJa+BFtuIob9zcPr37dFgE1Q1KC+Av4DysrrFj+sC0B9xob6TOu28WjpI619l8OPLrR/GW5/zo= X-Received: from sport.zrh.corp.google.com ([2a00:79e0:9d:4:fab0:4182:b9df:bfec]) (user=gnoack job=sendgmr) by 2002:a5d:4eca:0:b0:333:3402:7f72 with SMTP id s10-20020a5d4eca000000b0033334027f72mr17688wrv.7.1701441050636; Fri, 01 Dec 2023 06:30:50 -0800 (PST) Date: Fri, 1 Dec 2023 15:30:34 +0100 In-Reply-To: <20231201143042.3276833-1-gnoack@google.com> Message-Id: <20231201143042.3276833-2-gnoack@google.com> Precedence: bulk X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20231201143042.3276833-1-gnoack@google.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Subject: [PATCH v7 1/9] landlock: Remove remaining "inline" modifiers in .c files From: " =?utf-8?q?G=C3=BCnther_Noack?= " To: linux-security-module@vger.kernel.org, " =?utf-8?q?Micka=C3=ABl_Sala?= =?utf-8?q?=C3=BCn?= " Cc: Jeff Xu , Jorge Lucangeli Obes , Allen Webb , Dmitry Torokhov , Paul Moore , Konstantin Meskhidze , Matt Bobrowski , linux-fsdevel@vger.kernel.org, " =?utf-8?q?G=C3=BCnther_Noack?= " For module-internal static functions, compilers are already in a good position to decide whether to inline them or not. Suggested-by: Mickaël Salaün Signed-off-by: Günther Noack --- security/landlock/fs.c | 26 +++++++++++++------------- security/landlock/ruleset.c | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/security/landlock/fs.c b/security/landlock/fs.c index bc7c126deea2..9ba989ef46a5 100644 --- a/security/landlock/fs.c +++ b/security/landlock/fs.c @@ -193,7 +193,7 @@ int landlock_append_fs_rule(struct landlock_ruleset *const ruleset, * * Returns NULL if no rule is found or if @dentry is negative. */ -static inline const struct landlock_rule * +static const struct landlock_rule * find_rule(const struct landlock_ruleset *const domain, const struct dentry *const dentry) { @@ -220,7 +220,7 @@ find_rule(const struct landlock_ruleset *const domain, * sockfs, pipefs), but can still be reachable through * /proc//fd/ */ -static inline bool is_nouser_or_private(const struct dentry *dentry) +static bool is_nouser_or_private(const struct dentry *dentry) { return (dentry->d_sb->s_flags & SB_NOUSER) || (d_is_positive(dentry) && @@ -264,7 +264,7 @@ static const struct landlock_ruleset *get_current_fs_domain(void) * * @layer_masks_child2: Optional child masks. */ -static inline bool no_more_access( +static bool no_more_access( const layer_mask_t (*const layer_masks_parent1)[LANDLOCK_NUM_ACCESS_FS], const layer_mask_t (*const layer_masks_child1)[LANDLOCK_NUM_ACCESS_FS], const bool child1_is_directory, @@ -316,7 +316,7 @@ static inline bool no_more_access( * * Returns true if the request is allowed, false otherwise. */ -static inline bool +static bool scope_to_request(const access_mask_t access_request, layer_mask_t (*const layer_masks)[LANDLOCK_NUM_ACCESS_FS]) { @@ -335,7 +335,7 @@ scope_to_request(const access_mask_t access_request, * Returns true if there is at least one access right different than * LANDLOCK_ACCESS_FS_REFER. */ -static inline bool +static bool is_eacces(const layer_mask_t (*const layer_masks)[LANDLOCK_NUM_ACCESS_FS], const access_mask_t access_request) { @@ -551,9 +551,9 @@ static bool is_access_to_paths_allowed( return allowed_parent1 && allowed_parent2; } -static inline int check_access_path(const struct landlock_ruleset *const domain, - const struct path *const path, - access_mask_t access_request) +static int check_access_path(const struct landlock_ruleset *const domain, + const struct path *const path, + access_mask_t access_request) { layer_mask_t layer_masks[LANDLOCK_NUM_ACCESS_FS] = {}; @@ -565,8 +565,8 @@ static inline int check_access_path(const struct landlock_ruleset *const domain, return -EACCES; } -static inline int current_check_access_path(const struct path *const path, - const access_mask_t access_request) +static int current_check_access_path(const struct path *const path, + const access_mask_t access_request) { const struct landlock_ruleset *const dom = get_current_fs_domain(); @@ -575,7 +575,7 @@ static inline int current_check_access_path(const struct path *const path, return check_access_path(dom, path, access_request); } -static inline access_mask_t get_mode_access(const umode_t mode) +static access_mask_t get_mode_access(const umode_t mode) { switch (mode & S_IFMT) { case S_IFLNK: @@ -600,7 +600,7 @@ static inline access_mask_t get_mode_access(const umode_t mode) } } -static inline access_mask_t maybe_remove(const struct dentry *const dentry) +static access_mask_t maybe_remove(const struct dentry *const dentry) { if (d_is_negative(dentry)) return 0; @@ -1086,7 +1086,7 @@ static int hook_path_truncate(const struct path *const path) * Returns the access rights that are required for opening the given file, * depending on the file type and open mode. */ -static inline access_mask_t +static access_mask_t get_required_file_open_access(const struct file *const file) { access_mask_t access = 0; diff --git a/security/landlock/ruleset.c b/security/landlock/ruleset.c index ffedc99f2b68..789c81b26a50 100644 --- a/security/landlock/ruleset.c +++ b/security/landlock/ruleset.c @@ -305,7 +305,7 @@ int landlock_insert_rule(struct landlock_ruleset *const ruleset, return insert_rule(ruleset, id, &layers, ARRAY_SIZE(layers)); } -static inline void get_hierarchy(struct landlock_hierarchy *const hierarchy) +static void get_hierarchy(struct landlock_hierarchy *const hierarchy) { if (hierarchy) refcount_inc(&hierarchy->usage);