From: Himanshu Jha <himanshujha199640@gmail.com>
To: jejb@linux.vnet.ibm.com
Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, subbu.seetharaman@broadcom.com,
ketan.mukadam@broadcom.com, jitendra.bhivare@broadcom.com
Subject: Re: [PATCH v2] scsi: be2iscsi: Use kasprintf
Date: Fri, 3 Nov 2017 20:46:14 +0530 [thread overview]
Message-ID: <20171103151613.GA2601@himanshu-Vostro-3559> (raw)
In-Reply-To: <1507736174-13089-1-git-send-email-himanshujha199640@gmail.com>
On Wed, Oct 11, 2017 at 09:06:14PM +0530, Himanshu Jha wrote:
Hi James,
Just a reminder, is my patch in our queue ?
Thanks
Himanshu Jha
> Use kasprintf instead of combination of kmalloc and sprintf.
> Also, remove BEISCSI_MSI_NAME macro used to specify size of string as
> kasprintf handles size computations.
>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> ---
> v2:
> -remove the unnecessary macro BEISCSI_MSI_NAME.
>
> drivers/scsi/be2iscsi/be_main.c | 12 +++++-------
> drivers/scsi/be2iscsi/be_main.h | 2 --
> 2 files changed, 5 insertions(+), 9 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) {
> diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
> index 81ce3ff..8166de5 100644
> --- a/drivers/scsi/be2iscsi/be_main.h
> +++ b/drivers/scsi/be2iscsi/be_main.h
> @@ -155,8 +155,6 @@
> #define PAGES_REQUIRED(x) \
> ((x < PAGE_SIZE) ? 1 : ((x + PAGE_SIZE - 1) / PAGE_SIZE))
>
> -#define BEISCSI_MSI_NAME 20 /* size of msi_name string */
> -
> #define MEM_DESCR_OFFSET 8
> #define BEISCSI_DEFQ_HDR 1
> #define BEISCSI_DEFQ_DATA 0
> --
> 2.7.4
>
next prev parent reply other threads:[~2017-11-03 15:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 15:36 [PATCH v2] scsi: be2iscsi: Use kasprintf Himanshu Jha
2017-10-11 18:02 ` Kyle Fortin
2017-11-03 15:16 ` Himanshu Jha [this message]
2017-11-03 15:25 ` Martin K. Petersen
2017-11-03 16:10 ` Himanshu Jha
2017-11-03 16:25 ` Martin K. Petersen
2017-11-06 5:01 ` Jitendra Bhivare
2017-11-07 3:59 ` Martin K. Petersen
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=20171103151613.GA2601@himanshu-Vostro-3559 \
--to=himanshujha199640@gmail.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=jitendra.bhivare@broadcom.com \
--cc=ketan.mukadam@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=subbu.seetharaman@broadcom.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).