From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753316AbdHBMYo (ORCPT ); Wed, 2 Aug 2017 08:24:44 -0400 Received: from ganesha.gnumonks.org ([213.95.27.120]:51412 "EHLO ganesha.gnumonks.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753046AbdHBMYk (ORCPT ); Wed, 2 Aug 2017 08:24:40 -0400 Date: Wed, 2 Aug 2017 14:24:09 +0200 From: Pablo Neira Ayuso To: Julia Lawall Cc: "David S. Miller" , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, coreteam@netfilter.org, netfilter-devel@vger.kernel.org, Florian Westphal , Jozsef Kadlecsik , Alexey Kuznetsov , Hideaki YOSHIFUJI Subject: Re: [PATCH nf-next] netfilter: constify nf_loginfo structures Message-ID: <20170802122409.GB13459@salvia> References: <1501584483-999-1-git-send-email-Julia.Lawall@lip6.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1501584483-999-1-git-send-email-Julia.Lawall@lip6.fr> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -2.9 (--) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > // > @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 = { ... }; > // Applied, thanks Julia.