aic7xxx: Use kstrdup
authorHimangi Saraogi <himangi774@gmail.com>
Tue, 10 Jun 2014 14:18:47 +0000 (19:48 +0530)
committerChristoph Hellwig <hch@lst.de>
Fri, 25 Jul 2014 21:16:54 +0000 (17:16 -0400)
commit1f3d2d9edc832bdd5507130446abf1c8d2923ac5
treebda354a1ad74f1c49fe80eed0d9b5fc13b053695
parentc21a2c1a4973c8dde32557970fdb44eaa9489aeb
aic7xxx: Use kstrdup

Use kstrdup when the goal of an allocation is copy a string into the
allocated region.

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@@
expression from,to;
expression flag,E1,E2;
statement S;
@@

-  to = kmalloc(strlen(from) + 1,flag);
+  to = kstrdup(from, flag);
   ... when != \(from = E1 \| to = E1 \)
   if (to==NULL || ...) S
   ... when != \(from = E2 \| to = E2 \)
-  strcpy(to, from);
// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/aic7xxx/aic7770_osm.c
drivers/scsi/aic7xxx/aic79xx_osm_pci.c
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c