diff mbox series

[26/29] xfs: move xfs_xattr_handlers to .rodata

Message ID 20230930050033.41174-27-wedsonaf@gmail.com (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Wedson Almeida Filho Sept. 30, 2023, 5 a.m. UTC
From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
xfs_xattr_handlers at runtime.

Cc: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/xfs/xfs_xattr.c | 2 +-
 fs/xfs/xfs_xattr.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Darrick J. Wong Oct. 1, 2023, 4:18 p.m. UTC | #1
On Sat, Sep 30, 2023 at 02:00:30AM -0300, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> xfs_xattr_handlers at runtime.
> 
> Cc: "Darrick J. Wong" <djwong@kernel.org>
> Cc: linux-xfs@vger.kernel.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_xattr.c | 2 +-
>  fs/xfs/xfs_xattr.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
> index 43e5c219aaed..77418bcd6f3a 100644
> --- a/fs/xfs/xfs_xattr.c
> +++ b/fs/xfs/xfs_xattr.c
> @@ -175,7 +175,7 @@ static const struct xattr_handler xfs_xattr_security_handler = {
>  	.set	= xfs_xattr_set,
>  };
>  
> -const struct xattr_handler *xfs_xattr_handlers[] = {
> +const struct xattr_handler * const xfs_xattr_handlers[] = {
>  	&xfs_xattr_user_handler,
>  	&xfs_xattr_trusted_handler,
>  	&xfs_xattr_security_handler,
> diff --git a/fs/xfs/xfs_xattr.h b/fs/xfs/xfs_xattr.h
> index 2b09133b1b9b..cec766cad26c 100644
> --- a/fs/xfs/xfs_xattr.h
> +++ b/fs/xfs/xfs_xattr.h
> @@ -8,6 +8,6 @@
>  
>  int xfs_attr_change(struct xfs_da_args *args);
>  
> -extern const struct xattr_handler *xfs_xattr_handlers[];
> +extern const struct xattr_handler * const xfs_xattr_handlers[];
>  
>  #endif /* __XFS_XATTR_H__ */
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 43e5c219aaed..77418bcd6f3a 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -175,7 +175,7 @@  static const struct xattr_handler xfs_xattr_security_handler = {
 	.set	= xfs_xattr_set,
 };
 
-const struct xattr_handler *xfs_xattr_handlers[] = {
+const struct xattr_handler * const xfs_xattr_handlers[] = {
 	&xfs_xattr_user_handler,
 	&xfs_xattr_trusted_handler,
 	&xfs_xattr_security_handler,
diff --git a/fs/xfs/xfs_xattr.h b/fs/xfs/xfs_xattr.h
index 2b09133b1b9b..cec766cad26c 100644
--- a/fs/xfs/xfs_xattr.h
+++ b/fs/xfs/xfs_xattr.h
@@ -8,6 +8,6 @@ 
 
 int xfs_attr_change(struct xfs_da_args *args);
 
-extern const struct xattr_handler *xfs_xattr_handlers[];
+extern const struct xattr_handler * const xfs_xattr_handlers[];
 
 #endif /* __XFS_XATTR_H__ */