Skip to content

Commit 03bf004

Browse files
tititiou36akpm00
authored andcommitted
ocfs2: constify struct ocfs2_stack_operations
"struct ocfs2_stack_operations" are not modified in this driver. Constifying this structure moves some data to a read-only section, so increase overall security. In order to do it, "struct ocfs2_stack_plugin" also needs to be adjusted to this new const qualifier. On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 6241 644 0 6885 1ae5 fs/ocfs2/stack_o2cb.o After: ===== text data bss dec hex filename 6337 548 0 6885 1ae5 fs/ocfs2/stack_o2cb.o Link: https://lkml.kernel.org/r/f52dab89ee0049ec6271de29183a781efbb275ab.1718398605.git.christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Junxiao Bi <[email protected]> Cc: Joseph Qi <[email protected]> Cc: Changwei Ge <[email protected]> Cc: Gang He <[email protected]> Cc: Jun Piao <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 3ebe69c commit 03bf004

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

fs/ocfs2/stack_o2cb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ static int o2cb_cluster_this_node(struct ocfs2_cluster_connection *conn,
404404
return 0;
405405
}
406406

407-
static struct ocfs2_stack_operations o2cb_stack_ops = {
407+
static const struct ocfs2_stack_operations o2cb_stack_ops = {
408408
.connect = o2cb_cluster_connect,
409409
.disconnect = o2cb_cluster_disconnect,
410410
.this_node = o2cb_cluster_this_node,

fs/ocfs2/stack_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ static int user_cluster_this_node(struct ocfs2_cluster_connection *conn,
10651065
return 0;
10661066
}
10671067

1068-
static struct ocfs2_stack_operations ocfs2_user_plugin_ops = {
1068+
static const struct ocfs2_stack_operations ocfs2_user_plugin_ops = {
10691069
.connect = user_cluster_connect,
10701070
.disconnect = user_cluster_disconnect,
10711071
.this_node = user_cluster_this_node,

fs/ocfs2/stackglue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ struct ocfs2_stack_operations {
223223
*/
224224
struct ocfs2_stack_plugin {
225225
char *sp_name;
226-
struct ocfs2_stack_operations *sp_ops;
226+
const struct ocfs2_stack_operations *sp_ops;
227227
struct module *sp_owner;
228228

229229
/* These are managed by the stackglue code. */

0 commit comments

Comments
 (0)