driver core: module.c: Use kasprintf
commit1653268b1b538981df9bb85d637456530938be6c
authorJulia Lawall <julia@diku.dk>
Wed, 10 Mar 2010 21:18:13 +0000 (10 22:18 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 21 May 2010 16:37:29 +0000 (21 09:37 -0700)
treef091543b753e57e975bee35909b96c674daf3bd3
parentffa156590f98b750161757a16c37ac8e152a7859
driver core: module.c: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/module.c