diff mbox series

[15/29] jffs2: move jffs2_xattr_handlers to .rodata

Message ID 20230930050033.41174-16-wedsonaf@gmail.com (mailing list archive)
State New, archived
Headers show
Series const xattr tables | 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
jffs2_xattr_handlers at runtime.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/jffs2/xattr.c | 2 +-
 fs/jffs2/xattr.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Zhihao Cheng Oct. 7, 2023, 1:39 a.m. UTC | #1
在 2023/9/30 13:00, Wedson Almeida Filho 写道:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> jffs2_xattr_handlers at runtime.
> 
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Richard Weinberger <richard@nod.at>
> Cc: linux-mtd@lists.infradead.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> ---
>   fs/jffs2/xattr.c | 2 +-
>   fs/jffs2/xattr.h | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>

> diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
> index 3b6bdc9a49e1..00224f3a8d6e 100644
> --- a/fs/jffs2/xattr.c
> +++ b/fs/jffs2/xattr.c
> @@ -920,7 +920,7 @@ struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
>    * do_jffs2_setxattr(inode, xprefix, xname, buffer, size, flags)
>    *   is an implementation of setxattr handler on jffs2.
>    * -------------------------------------------------- */
> -const struct xattr_handler *jffs2_xattr_handlers[] = {
> +const struct xattr_handler * const jffs2_xattr_handlers[] = {
>   	&jffs2_user_xattr_handler,
>   #ifdef CONFIG_JFFS2_FS_SECURITY
>   	&jffs2_security_xattr_handler,
> diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
> index 1b5030a3349d..7e7de093ec0a 100644
> --- a/fs/jffs2/xattr.h
> +++ b/fs/jffs2/xattr.h
> @@ -94,7 +94,7 @@ extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname
>   extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname,
>   			     const char *buffer, size_t size, int flags);
>   
> -extern const struct xattr_handler *jffs2_xattr_handlers[];
> +extern const struct xattr_handler * const jffs2_xattr_handlers[];
>   extern const struct xattr_handler jffs2_user_xattr_handler;
>   extern const struct xattr_handler jffs2_trusted_xattr_handler;
>   
>
diff mbox series

Patch

diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index 3b6bdc9a49e1..00224f3a8d6e 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -920,7 +920,7 @@  struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
  * do_jffs2_setxattr(inode, xprefix, xname, buffer, size, flags)
  *   is an implementation of setxattr handler on jffs2.
  * -------------------------------------------------- */
-const struct xattr_handler *jffs2_xattr_handlers[] = {
+const struct xattr_handler * const jffs2_xattr_handlers[] = {
 	&jffs2_user_xattr_handler,
 #ifdef CONFIG_JFFS2_FS_SECURITY
 	&jffs2_security_xattr_handler,
diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
index 1b5030a3349d..7e7de093ec0a 100644
--- a/fs/jffs2/xattr.h
+++ b/fs/jffs2/xattr.h
@@ -94,7 +94,7 @@  extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname
 extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname,
 			     const char *buffer, size_t size, int flags);
 
-extern const struct xattr_handler *jffs2_xattr_handlers[];
+extern const struct xattr_handler * const jffs2_xattr_handlers[];
 extern const struct xattr_handler jffs2_user_xattr_handler;
 extern const struct xattr_handler jffs2_trusted_xattr_handler;