• Himangi Saraogi's avatar
    aic7xxx: Use kstrdup · 1f3d2d9e
    Himangi Saraogi authored
    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: default avatarHimangi Saraogi <himangi774@gmail.com>
    Acked-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    1f3d2d9e
aic79xx_osm_pci.c 10.3 KB