Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1702074
| From | Pablo Neira Ayuso <pablo@netfilter.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH nf-next] netfilter: constify nf_loginfo structures |
| Date | 2017-08-02 14:30 +0200 |
| Message-ID | <ua0WK-1ph-5@gated-at.bofh.it> (permalink) |
| References | <u9Dnr-3jr-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Aug 01, 2017 at 12:48:03PM +0200, Julia Lawall wrote:
> The nf_loginfo structures are only passed as the seventh argument to
> nf_log_trace, which is declared as const or stored in a local const
> variable. Thus the nf_loginfo structures themselves can be const.
>
> Done with the help of Coccinelle.
>
> // <smpl>
> @r disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct nf_loginfo i@p = { ... };
>
> @ok1@
> identifier r.i;
> expression list[6] es;
> position p;
> @@
> nf_log_trace(es,&i@p,...)
>
> @ok2@
> identifier r.i;
> const struct nf_loginfo *e;
> position p;
> @@
> e = &i@p
>
> @bad@
> position p != {r.p,ok1.p,ok2.p};
> identifier r.i;
> struct nf_loginfo e;
> @@
> e@i@p
>
> @depends on !bad disable optional_qualifier@
> identifier r.i;
> @@
> static
> +const
> struct nf_loginfo i = { ... };
> // </smpl>
Applied, thanks Julia.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH nf-next] netfilter: constify nf_loginfo structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-08-01 13:20 +0200 Re: [PATCH nf-next] netfilter: constify nf_loginfo structures Pablo Neira Ayuso <pablo@netfilter.org> - 2017-08-02 14:30 +0200
csiph-web