From patchwork Fri Oct 6 18:57:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Jha X-Patchwork-Id: 9990251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D142060244 for ; Fri, 6 Oct 2017 18:58:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCA4028E51 for ; Fri, 6 Oct 2017 18:58:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1B6A28E53; Fri, 6 Oct 2017 18:58:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_HI, RCVD_IN_SBL_CSS, RCVD_IN_SORBS_SPAM, RCVD_IN_SORBS_WEB autolearn=no version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C023F28E51 for ; Fri, 6 Oct 2017 18:58:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752428AbdJFS6J (ORCPT ); Fri, 6 Oct 2017 14:58:09 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:37328 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751491AbdJFS6I (ORCPT ); Fri, 6 Oct 2017 14:58:08 -0400 Received: by mail-pg0-f65.google.com with SMTP id o1so17847682pga.4; Fri, 06 Oct 2017 11:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=6imVy09ZLeNG6t0s9sghwHQAz+bqiZAqEk5zl/hMkC8=; b=aVCcI2F2z2Aon9Z41Rv191eIAJsr8aNSYrQnV2C6Sc4ZJzW3yWc0q9qqNvzH7+APmX +i7RSkI+hYrMEqKQj/yPvqv6bGxHZLVWU0ztL2bwqnWR4YR7gBRcTchgxglFh0Os1tM7 lH3Ri9WgccfiGAAc2Myxhb/y6/HLYnboKTR5hrNZDiJXq1/2Vn8orMaGAcbXo/94BwZs ST+xRkibKk8gU7RQLBXesJU8pwmKOQYOnqbfwjO3a2Emlm8R6SJkxTP74o3o6a4oYTUZ iwE7dH/8ySQcuzvCruOoVUXWUq9YDaehLS7IxcCSKe9EwDLOKEREVGpPoXLK5gkirH9F vMCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6imVy09ZLeNG6t0s9sghwHQAz+bqiZAqEk5zl/hMkC8=; b=j5cH6crPkEPMV6/Vu0R5OQixYAqO8CZz2vfsB2iF2E8WCQ19nuFd4cPnpDGoTv3j+S BF2pPolqK1UqTw2Lv00m6m3UAkRT178PxttRmbQ08So/EwaPzIxmH/sRu8IinPTfmwmj HY2B47FXcu5rKvAQ5HyCBuAyUgpXMDRHHxRi7WW2mnhvCyV6CyP7N5ZYvYG/8MfviMsQ aviO4mlJKL92/YvUlpGFtzalV6ylqEWfEKQVG8HH1c0kuqzUlLwe8pTvytp/RtcXxrW8 IFScmBQsD1IeEHc6VTIOyH2drSE0dgctBGoSa2NsBHaBBR1TbznqwBcns1j+CIh4EJqL b6jA== X-Gm-Message-State: AMCzsaWzwf7+xM3Thv9Ea0QRpfBCg5030jrcZ31tNFKr6ohceeEg/gSI SuychA9mzowj4qj0wFOUMYw= X-Google-Smtp-Source: AOwi7QBIm3hYtWG9/bR2iNHDpJVvPPBhw2PZF1yh9qQ+8JFiPwpy8K7p6px8VAzkl1KxXdjdpUiEJQ== X-Received: by 10.84.234.130 with SMTP id n2mr2796352plk.189.1507316288271; Fri, 06 Oct 2017 11:58:08 -0700 (PDT) Received: from localhost.localdomain ([103.254.204.108]) by smtp.gmail.com with ESMTPSA id 133sm4529635pfy.2.2017.10.06.11.58.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Oct 2017 11:58:06 -0700 (PDT) From: Himanshu Jha To: jejb@linux.vnet.ibm.com Cc: martin.petersen@oracle.com, subbu.seetharaman@broadcom.com, ketan.mukadam@broadcom.com, jitendra.bhivare@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Himanshu Jha Subject: [PATCH] scsi: be2iscsi: Use kasprintf Date: Sat, 7 Oct 2017 00:27:45 +0530 Message-Id: <1507316265-9672-1-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use kasprintf instead of combination of kmalloc and sprintf. Signed-off-by: Himanshu Jha --- drivers/scsi/be2iscsi/be_main.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index b4542e7..6a9ee0e 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -803,15 +803,14 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba) if (pcidev->msix_enabled) { for (i = 0; i < phba->num_cpus; i++) { - phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME, - GFP_KERNEL); + phba->msi_name[i] = kasprintf(GFP_KERNEL, + "beiscsi_%02x_%02x", + phba->shost->host_no, i); if (!phba->msi_name[i]) { ret = -ENOMEM; goto free_msix_irqs; } - sprintf(phba->msi_name[i], "beiscsi_%02x_%02x", - phba->shost->host_no, i); ret = request_irq(pci_irq_vector(pcidev, i), be_isr_msix, 0, phba->msi_name[i], &phwi_context->be_eq[i]); @@ -824,13 +823,12 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba) goto free_msix_irqs; } } - phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME, GFP_KERNEL); + phba->msi_name[i] = kasprintf(GFP_KERNEL, "beiscsi_mcc_%02x", + phba->shost->host_no); if (!phba->msi_name[i]) { ret = -ENOMEM; goto free_msix_irqs; } - sprintf(phba->msi_name[i], "beiscsi_mcc_%02x", - phba->shost->host_no); ret = request_irq(pci_irq_vector(pcidev, i), be_isr_mcc, 0, phba->msi_name[i], &phwi_context->be_eq[i]); if (ret) {