From: julia.lawall@lip6.fr (Julia Lawall)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Weird whitespace behavior?
Date: Tue, 12 Jun 2018 06:54:36 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.20.1806120653280.2309@hadrien> (raw)
In-Reply-To: <CAGXu5jKybK9vJ3jaDXx8LYhdvkwy4C4UcC46Qww+tzPof1LJBQ@mail.gmail.com>
On Mon, 11 Jun 2018, Kees Cook wrote:
> On Mon, Jun 11, 2018 at 4:17 PM, Kees Cook <keescook@google.com> wrote:
> > Hi,
> >
> > I've been doing some large treewide changes to the allocators, and I
> > notice that Coccinelle does something odd for a specific case. I have
> > two scripts, one operating on kmalloc() and one operating on
> > devm_kmalloc(). They are identical script except for the function
> > names, however, while kmalloc produces patches like this:
> >
> > - foo = kmalloc(a * b, gfp);
> > + foo = kmalloc_array(a, b, gfp);
> >
> > the devm_kmalloc one produces:
> >
> > - foo = devm_kmalloc(handle, a * b, gfp);
> > + foo =devm_kmalloc_array(a, b, gfp);
> >
> > I can't figure out why the space after "=" is missing and have been
> > manually fixing it up...
I would need your semantic patch to see the problem.
> And while I'm at it... line breaks aren't working like I'd expect:
>
> - collection = kmalloc(sizeof(struct hid_collection) *
> - parser->device->collection_size * 2,
> GFP_KERNEL);
> + collection = kmalloc(array3_size(sizeof(struct
> hid_collection), parser->device->collection_size, 2),
> + GFP_KERNEL);
>
> Why wasn't array3_size() correctly line wrapped?
I think that line breaking only works on the outermost function call.
julia
next prev parent reply other threads:[~2018-06-12 4:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 23:17 [Cocci] Weird whitespace behavior? Kees Cook
2018-06-12 2:38 ` Kees Cook
2018-06-12 4:54 ` Julia Lawall [this message]
2018-06-30 11:30 ` [Cocci] Increasing usage of array allocation functions with SmPL SF Markus Elfring
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=alpine.DEB.2.20.1806120653280.2309@hadrien \
--to=julia.lawall@lip6.fr \
--cc=cocci@systeme.lip6.fr \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox