[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1373720462-13190-1-git-send-email-dragos.foianu@gmail.com>
Date: Sat, 13 Jul 2013 14:01:02 +0100
From: Dragos Foianu <dragos.foianu@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Dragos Foianu <dragos.foianu@...il.com>
Subject: [PATCH] aic7xxx/aic79xx: replaced string duplication code with kstrdup
Replaced kmalloc + strcpy code with kstrdup.
Found using coccinelle.
Signed-off-by: Dragos Foianu <dragos.foianu@...il.com>
---
drivers/scsi/aic7xxx/aic79xx_osm_pci.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
index 3c85873..8466aa7 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
@@ -178,10 +178,9 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ahd_get_pci_bus(pci),
ahd_get_pci_slot(pci),
ahd_get_pci_function(pci));
- name = kmalloc(strlen(buf) + 1, GFP_ATOMIC);
+ name = kstrdup(buf, GFP_ATOMIC);
if (name == NULL)
return (-ENOMEM);
- strcpy(name, buf);
ahd = ahd_alloc(NULL, name);
if (ahd == NULL)
return (-ENOMEM);
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists