]> git.karo-electronics.de Git - linux-beck.git/commit
Staging: lustre: obdclass: Use kasprintf instead of kzalloc and sprintf
authorShraddha Barke <shraddha.6596@gmail.com>
Fri, 4 Sep 2015 06:38:42 +0000 (12:08 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Sep 2015 01:24:48 +0000 (18:24 -0700)
commit222a7e9166b90f7cfd683a192cc757181b95a34f
tree0058221cd851830da0ae8961baa60e975e4a3af9
parent2de5855cf96a798bc95cb13f94b6ba7a142f2f1f
Staging: lustre: obdclass: Use kasprintf instead of kzalloc and sprintf

This patch uses kasprintf which combines kzalloc and sprintf.

kasprintf also takes care of the size calculation.

Semantic patch used is as follows:

@@
expression a,flag;
expression list args;
statement S;
@@

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

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/obdclass/obd_config.c