From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: hare@suse.de, JBottomley@odin.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr> Subject: [PATCH v2] aic7xxx: replace kmalloc/strcpy by kstrdup Date: Tue, 14 Jul 2015 12:02:13 +0200 [thread overview] Message-ID: <1436868133-32096-1-git-send-email-christophe.jaillet@wanadoo.fr> (raw) In-Reply-To: <4159f01e6450cee8093e7d6a0d979bbeab8243d0.1436858599.git.christophe.jaillet@wanadoo.fr> This replaces kmalloc + strcpy by an equivalent call to kstrdup. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> --- v2: remove useless curly braces drivers/scsi/aic7xxx/aic79xx_osm.c | 6 ++---- drivers/scsi/aic7xxx/aic7xxx_osm.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index ce96a0b..ea4086e 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -1250,11 +1250,9 @@ ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *templa ahd_set_unit(ahd, ahd_linux_unit++); ahd_unlock(ahd, &s); sprintf(buf, "scsi%d", host->host_no); - new_name = kmalloc(strlen(buf) + 1, GFP_ATOMIC); - if (new_name != NULL) { - strcpy(new_name, buf); + new_name = kstrdup(buf, GFP_ATOMIC); + if (new_name != NULL) ahd_set_name(ahd, new_name); - } host->unique_id = ahd->unit; ahd_linux_initialize_scsi_bus(ahd); ahd_intr_enable(ahd, TRUE); diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index a2f2c77..f0ac966 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -1114,11 +1114,9 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa ahc_set_unit(ahc, ahc_linux_unit++); ahc_unlock(ahc, &s); sprintf(buf, "scsi%d", host->host_no); - new_name = kmalloc(strlen(buf) + 1, GFP_ATOMIC); - if (new_name != NULL) { - strcpy(new_name, buf); + new_name = kstrdup(buf, GFP_ATOMIC); + if (new_name != NULL) ahc_set_name(ahc, new_name); - } host->unique_id = ahc->unit; ahc_linux_initialize_scsi_bus(ahc); ahc_intr_enable(ahc, TRUE); -- 2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: hare@suse.de, JBottomley@odin.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr> Subject: [PATCH v2] aic7xxx: replace kmalloc/strcpy by kstrdup Date: Tue, 14 Jul 2015 10:02:13 +0000 [thread overview] Message-ID: <1436868133-32096-1-git-send-email-christophe.jaillet@wanadoo.fr> (raw) In-Reply-To: <4159f01e6450cee8093e7d6a0d979bbeab8243d0.1436858599.git.christophe.jaillet@wanadoo.fr> This replaces kmalloc + strcpy by an equivalent call to kstrdup. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> --- v2: remove useless curly braces drivers/scsi/aic7xxx/aic79xx_osm.c | 6 ++---- drivers/scsi/aic7xxx/aic7xxx_osm.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index ce96a0b..ea4086e 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -1250,11 +1250,9 @@ ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *templa ahd_set_unit(ahd, ahd_linux_unit++); ahd_unlock(ahd, &s); sprintf(buf, "scsi%d", host->host_no); - new_name = kmalloc(strlen(buf) + 1, GFP_ATOMIC); - if (new_name != NULL) { - strcpy(new_name, buf); + new_name = kstrdup(buf, GFP_ATOMIC); + if (new_name != NULL) ahd_set_name(ahd, new_name); - } host->unique_id = ahd->unit; ahd_linux_initialize_scsi_bus(ahd); ahd_intr_enable(ahd, TRUE); diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index a2f2c77..f0ac966 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -1114,11 +1114,9 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa ahc_set_unit(ahc, ahc_linux_unit++); ahc_unlock(ahc, &s); sprintf(buf, "scsi%d", host->host_no); - new_name = kmalloc(strlen(buf) + 1, GFP_ATOMIC); - if (new_name != NULL) { - strcpy(new_name, buf); + new_name = kstrdup(buf, GFP_ATOMIC); + if (new_name != NULL) ahc_set_name(ahc, new_name); - } host->unique_id = ahc->unit; ahc_linux_initialize_scsi_bus(ahc); ahc_intr_enable(ahc, TRUE); -- 2.1.4
next prev parent reply other threads:[~2015-07-14 10:02 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-07-14 7:25 [PATCH] aic7xxx: replace kmalloc/strcpy by kstrdup Christophe JAILLET 2015-07-14 7:25 ` Christophe JAILLET 2015-07-14 9:08 ` Dan Carpenter 2015-07-14 9:08 ` Dan Carpenter 2015-07-14 10:02 ` Christophe JAILLET [this message] 2015-07-14 10:02 ` [PATCH v2] " Christophe JAILLET 2015-07-14 10:07 ` Hannes Reinecke 2015-07-14 10:07 ` Hannes Reinecke 2015-07-14 10:07 ` Hannes Reinecke 2015-07-14 11:27 ` walter harms 2015-07-14 11:27 ` walter harms
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1436868133-32096-1-git-send-email-christophe.jaillet@wanadoo.fr \ --to=christophe.jaillet@wanadoo.fr \ --cc=JBottomley@odin.com \ --cc=hare@suse.de \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-scsi@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.