lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1477592474-18513-1-git-send-email-bhumirks@gmail.com>
Date:   Thu, 27 Oct 2016 23:51:14 +0530
From:   Bhumika Goyal <bhumirks@...il.com>
To:     ccaulfie@...hat.com, teigland@...hat.com, cluster-devel@...hat.com,
        linux-kernel@...r.kernel.org, julia.lawall@...6.fr
Cc:     Bhumika Goyal <bhumirks@...il.com>
Subject: [PATCH] fs: dlm: lockspace: constify kset_uevent_ops structures

Declare kset_uevent_ops structure as const as it is only passed as
the second argument to the function kset_create_and_add. This
argument is of type const struct kset_uevent_ops *, so kset_uevent_ops 
structures having this property can be declared const.
Done using Coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct kset_uevent_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
expression e1,e2;
@@
kset_create_and_add(e1,&i@p,e2)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct kset_uevent_ops i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct kset_uevent_ops i;

File size before:
   text	   data	    bss	    dec	    hex	filename
   8034	    528	    484	   9046	   2356	fs/dlm/lockspace.o

File size after:
   text	   data	    bss	    dec	    hex	filename
   8050	    496	    484	   9030	   2346	fs/dlm/lockspace.o

Signed-off-by: Bhumika Goyal <bhumirks@...il.com>
---
 fs/dlm/lockspace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index f3e7278..2ea1b77 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -233,7 +233,7 @@ static int dlm_uevent(struct kset *kset, struct kobject *kobj,
 	return 0;
 }
 
-static struct kset_uevent_ops dlm_uevent_ops = {
+static const struct kset_uevent_ops dlm_uevent_ops = {
 	.uevent = dlm_uevent,
 };
 
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ