]> bbs.cooldavid.org Git - net-next-2.6.git/commit
powerpc/pseries/dlpar: Use kasprintf
authorJulia Lawall <julia@diku.dk>
Wed, 10 Mar 2010 11:15:01 +0000 (11:15 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 7 Apr 2010 08:00:42 +0000 (18:00 +1000)
commit43caa61f154da85a620965f3f61c2f45366d8dc7
treeea487c9de02013c1b5d4fad8d1fde7517244bf17
parenta7df5c5e52a545774c4db1f2adf09ede018ab139
powerpc/pseries/dlpar: Use kasprintf

kasprintf combines kmalloc and sprintf, and takes care of the size
calculation itself.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression a,flag;
expression list args;
statement S;
@@

  a =
-  \(kmalloc\|kzalloc\)(...,flag)
+  kasprintf(flag,args)
  <... when != a
  if (a == NULL || ...) S
  ...>
- sprintf(a,args);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Nathan Fontenot <nfont@austin.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/pseries/dlpar.c