Skip to content

Commit 596ce53

Browse files
tititiou36teigland
authored andcommitted
dlm: Constify struct configfs_item_operations and configfs_group_operations
'struct configfs_item_operations' and 'configfs_group_operations' are not modified in this driver. Constifying these structures moves some data to a read-only section, so increases overall security, especially when the structure holds some function pointers. On a x86_64, with allmodconfig, as an example: Before: ====== text data bss dec hex filename 29436 12952 384 42772 a714 fs/dlm/config.o After: ===== text data bss dec hex filename 30076 12312 384 42772 a714 fs/dlm/config.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent 6155b40 commit 596ce53

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

fs/dlm/config.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,39 +324,39 @@ struct dlm_member_gone {
324324
struct list_head list; /* space->members_gone */
325325
};
326326

327-
static struct configfs_group_operations clusters_ops = {
327+
static const struct configfs_group_operations clusters_ops = {
328328
.make_group = make_cluster,
329329
.drop_item = drop_cluster,
330330
};
331331

332-
static struct configfs_item_operations cluster_ops = {
332+
static const struct configfs_item_operations cluster_ops = {
333333
.release = release_cluster,
334334
};
335335

336-
static struct configfs_group_operations spaces_ops = {
336+
static const struct configfs_group_operations spaces_ops = {
337337
.make_group = make_space,
338338
.drop_item = drop_space,
339339
};
340340

341-
static struct configfs_item_operations space_ops = {
341+
static const struct configfs_item_operations space_ops = {
342342
.release = release_space,
343343
};
344344

345-
static struct configfs_group_operations comms_ops = {
345+
static const struct configfs_group_operations comms_ops = {
346346
.make_item = make_comm,
347347
.drop_item = drop_comm,
348348
};
349349

350-
static struct configfs_item_operations comm_ops = {
350+
static const struct configfs_item_operations comm_ops = {
351351
.release = release_comm,
352352
};
353353

354-
static struct configfs_group_operations nodes_ops = {
354+
static const struct configfs_group_operations nodes_ops = {
355355
.make_item = make_node,
356356
.drop_item = drop_node,
357357
};
358358

359-
static struct configfs_item_operations node_ops = {
359+
static const struct configfs_item_operations node_ops = {
360360
.release = release_node,
361361
};
362362

0 commit comments

Comments
 (0)