From patchwork Tue Jul 14 07:25:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 6784071 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 126539F38C for ; Tue, 14 Jul 2015 07:26:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3AB44205B4 for ; Tue, 14 Jul 2015 07:26:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5AC29205B3 for ; Tue, 14 Jul 2015 07:26:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752754AbbGNH0E (ORCPT ); Tue, 14 Jul 2015 03:26:04 -0400 Received: from smtp12.smtpout.orange.fr ([80.12.242.134]:42647 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752755AbbGNH0D (ORCPT ); Tue, 14 Jul 2015 03:26:03 -0400 Received: from localhost.localdomain ([92.140.160.103]) by mwinf5d35 with ME id s7Ry1q00B2E8xV0037Ry34; Tue, 14 Jul 2015 09:26:00 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 14 Jul 2015 09:26:00 +0200 X-ME-IP: 92.140.160.103 From: Christophe JAILLET 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 Subject: [PATCH] aic7xxx: replace kmalloc/strcpy by kstrdup Date: Tue, 14 Jul 2015 09:25:16 +0200 Message-Id: <4159f01e6450cee8093e7d6a0d979bbeab8243d0.1436858599.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.1.4 X-Antivirus: avast! (VPS 150713-1, 13/07/2015), Outbound message X-Antivirus-Status: Clean Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This replaces kmalloc + strcpy by an equivalent call to kstrdup. Signed-off-by: Christophe JAILLET --- drivers/scsi/aic7xxx/aic79xx_osm.c | 3 +-- drivers/scsi/aic7xxx/aic7xxx_osm.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index ce96a0b..ae78e6d 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -1250,9 +1250,8 @@ 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); + new_name = kstrdup(buf, GFP_ATOMIC); if (new_name != NULL) { - strcpy(new_name, buf); ahd_set_name(ahd, new_name); } host->unique_id = ahd->unit; diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index a2f2c77..ba59947 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -1114,9 +1114,8 @@ 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); + new_name = kstrdup(buf, GFP_ATOMIC); if (new_name != NULL) { - strcpy(new_name, buf); ahc_set_name(ahc, new_name); } host->unique_id = ahc->unit;