mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-20 00:11:22 +00:00
netfilter: constify nf_loginfo structures
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> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
2a04aabf5c
commit
549d2d41c1
@ -151,7 +151,7 @@ static const char *const comments[] = {
|
||||
[NF_IP_TRACE_COMMENT_POLICY] = "policy",
|
||||
};
|
||||
|
||||
static struct nf_loginfo trace_loginfo = {
|
||||
static const struct nf_loginfo trace_loginfo = {
|
||||
.type = NF_LOG_TYPE_LOG,
|
||||
.u = {
|
||||
.log = {
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <linux/netfilter/xt_LOG.h>
|
||||
#include <net/netfilter/nf_log.h>
|
||||
|
||||
static struct nf_loginfo default_loginfo = {
|
||||
static const struct nf_loginfo default_loginfo = {
|
||||
.type = NF_LOG_TYPE_LOG,
|
||||
.u = {
|
||||
.log = {
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <linux/netfilter/xt_LOG.h>
|
||||
#include <net/netfilter/nf_log.h>
|
||||
|
||||
static struct nf_loginfo default_loginfo = {
|
||||
static const struct nf_loginfo default_loginfo = {
|
||||
.type = NF_LOG_TYPE_LOG,
|
||||
.u = {
|
||||
.log = {
|
||||
|
@ -176,7 +176,7 @@ static const char *const comments[] = {
|
||||
[NF_IP6_TRACE_COMMENT_POLICY] = "policy",
|
||||
};
|
||||
|
||||
static struct nf_loginfo trace_loginfo = {
|
||||
static const struct nf_loginfo trace_loginfo = {
|
||||
.type = NF_LOG_TYPE_LOG,
|
||||
.u = {
|
||||
.log = {
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <linux/netfilter/xt_LOG.h>
|
||||
#include <net/netfilter/nf_log.h>
|
||||
|
||||
static struct nf_loginfo default_loginfo = {
|
||||
static const struct nf_loginfo default_loginfo = {
|
||||
.type = NF_LOG_TYPE_LOG,
|
||||
.u = {
|
||||
.log = {
|
||||
|
@ -29,7 +29,7 @@ static const char *const comments[__NFT_TRACETYPE_MAX] = {
|
||||
[NFT_TRACETYPE_RULE] = "rule",
|
||||
};
|
||||
|
||||
static struct nf_loginfo trace_loginfo = {
|
||||
static const struct nf_loginfo trace_loginfo = {
|
||||
.type = NF_LOG_TYPE_LOG,
|
||||
.u = {
|
||||
.log = {
|
||||
|
@ -606,7 +606,7 @@ nla_put_failure:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static struct nf_loginfo default_loginfo = {
|
||||
static const struct nf_loginfo default_loginfo = {
|
||||
.type = NF_LOG_TYPE_ULOG,
|
||||
.u = {
|
||||
.ulog = {
|
||||
|
Loading…
Reference in New Issue
Block a user