diff mbox series

[v1,2/2] landlock: Constify get_mode_access()

Message ID 20250110153918.241810-2-mic@digikod.net (mailing list archive)
State New
Headers show
Series [v1,1/2] landlock: Handle weird files | expand

Commit Message

Mickaël Salaün Jan. 10, 2025, 3:39 p.m. UTC
Use __attribute_const__ for get_mode_access().

Cc: Günther Noack <gnoack@google.com>
Signed-off-by: Mickaël Salaün <mic@digikod.net>
---
 security/landlock/fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Günther Noack Jan. 10, 2025, 4:39 p.m. UTC | #1
On Fri, Jan 10, 2025 at 04:39:14PM +0100, Mickaël Salaün wrote:
> Use __attribute_const__ for get_mode_access().
> 
> Cc: Günther Noack <gnoack@google.com>
> Signed-off-by: Mickaël Salaün <mic@digikod.net>
> ---
>  security/landlock/fs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/security/landlock/fs.c b/security/landlock/fs.c
> index 7adb25150488..f81d0335b825 100644
> --- a/security/landlock/fs.c
> +++ b/security/landlock/fs.c
> @@ -932,7 +932,7 @@ static int current_check_access_path(const struct path *const path,
>  	return check_access_path(dom, path, access_request);
>  }
>  
> -static access_mask_t get_mode_access(const umode_t mode)
> +static __attribute_const__ access_mask_t get_mode_access(const umode_t mode)
>  {
>  	switch (mode & S_IFMT) {
>  	case S_IFLNK:
> -- 
> 2.47.1
> 

Reviewed-by: Günther Noack <gnoack3000@gmail.com>
diff mbox series

Patch

diff --git a/security/landlock/fs.c b/security/landlock/fs.c
index 7adb25150488..f81d0335b825 100644
--- a/security/landlock/fs.c
+++ b/security/landlock/fs.c
@@ -932,7 +932,7 @@  static int current_check_access_path(const struct path *const path,
 	return check_access_path(dom, path, access_request);
 }
 
-static access_mask_t get_mode_access(const umode_t mode)
+static __attribute_const__ access_mask_t get_mode_access(const umode_t mode)
 {
 	switch (mode & S_IFMT) {
 	case S_IFLNK: