All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Tim Deegan <tim@xen.org>, Keir Fraser <keir@xen.org>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Jan Beulich <JBeulich@suse.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] xen/many: xfree() can tolerate NULL pointers
Date: Mon, 19 Jan 2015 11:12:48 +0000	[thread overview]
Message-ID: <54BCE6B0.6090707@citrix.com> (raw)
In-Reply-To: <1421664847.10440.41.camel@citrix.com>

On 19/01/15 10:54, Ian Campbell wrote:
> On Mon, 2015-01-19 at 10:42 +0000, Andrew Cooper wrote:
>> Replace instances of "if ( p ) xfree(p)" with just "xfree(p)"
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> CC: Keir Fraser <keir@xen.org>
>> CC: Jan Beulich <JBeulich@suse.com>
>> CC: Tim Deegan <tim@xen.org>
>> CC: Ian Campbell <Ian.Campbell@citrix.com>
>> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
>>
>> ---
>>
>> This was from some experimentation with semantic patches.  'spatch' can't
>> currently parse some of our macros (e.g. XEN_GUEST_HANDLE()), which cases it
>> to skip large numbers of functions in the codebase
> How annoying! (and surprising)

It also can't parse the "case $X ... $Y:" syntax if the spaces around
the ellipsis is missing.  This is a little more understandable as this
gccism does introduce an ambiguity into the grammar, insofar that 1...3
is not a valid floating point constant.

We have a number of uses with #defined numbers uses without spaces. 
This turns out to be safe only because the preprocessor replacement puts
spaces around replaced tokens.

>
> Anyway, could you include the spatch in the commit log, for completeness
> and for future cargo culting ;-) (unless it's huge, I guess)

It was tiny, but sadly scummed to a `git clean`.  I can't even recall
which of the many kfree() variants I ended up modifying (s/k/x/), but
there is a huge library of generic and Linux specific semantic patches
at https://github.com/coccinelle/coccinellery

~Andrew

  reply	other threads:[~2015-01-19 11:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19 10:42 [PATCH] xen/many: xfree() can tolerate NULL pointers Andrew Cooper
2015-01-19 10:54 ` Ian Campbell
2015-01-19 11:12   ` Andrew Cooper [this message]
2015-01-19 11:18     ` Ian Campbell
2015-01-19 11:47       ` Ian Jackson
2015-01-19 12:14         ` Jan Beulich
2015-01-19 12:19           ` Ian Jackson
2015-01-19 11:29     ` Jan Beulich
2015-01-19 11:43   ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54BCE6B0.6090707@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.