* [PATCH v2] scsi: be2iscsi: Use kasprintf
@ 2017-10-11 15:36 Himanshu Jha
2017-10-11 18:02 ` Kyle Fortin
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Himanshu Jha @ 2017-10-11 15:36 UTC (permalink / raw)
To: jejb
Cc: martin.petersen, linux-scsi, linux-kernel, subbu.seetharaman,
ketan.mukadam, jitendra.bhivare, 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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] scsi: be2iscsi: Use kasprintf
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
2017-11-06 5:01 ` Jitendra Bhivare
2 siblings, 0 replies; 8+ messages in thread
From: Kyle Fortin @ 2017-10-11 18:02 UTC (permalink / raw)
To: Himanshu Jha
Cc: jejb, martin.petersen, linux-scsi, linux-kernel,
subbu.seetharaman, ketan.mukadam, jitendra.bhivare
On Oct 11, 2017, at 11:36 AM, Himanshu Jha <himanshujha199640@gmail.com> wrote:
>
> 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
>
Looks good.
Reviewed-by: Kyle Fortin <kyle.fortin@oracle.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] scsi: be2iscsi: Use kasprintf
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
2017-11-03 15:25 ` Martin K. Petersen
2017-11-06 5:01 ` Jitendra Bhivare
2 siblings, 1 reply; 8+ messages in thread
From: Himanshu Jha @ 2017-11-03 15:16 UTC (permalink / raw)
To: jejb
Cc: martin.petersen, linux-scsi, linux-kernel, subbu.seetharaman,
ketan.mukadam, jitendra.bhivare
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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] scsi: be2iscsi: Use kasprintf
2017-11-03 15:16 ` Himanshu Jha
@ 2017-11-03 15:25 ` Martin K. Petersen
2017-11-03 16:10 ` Himanshu Jha
0 siblings, 1 reply; 8+ messages in thread
From: Martin K. Petersen @ 2017-11-03 15:25 UTC (permalink / raw)
To: Himanshu Jha
Cc: jejb, martin.petersen, linux-scsi, linux-kernel,
subbu.seetharaman, ketan.mukadam, jitendra.bhivare
Himanshu,
> Just a reminder, is my patch in our queue ?
It is not. It needs a review/ack from the driver maintainers.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] scsi: be2iscsi: Use kasprintf
2017-11-03 15:25 ` Martin K. Petersen
@ 2017-11-03 16:10 ` Himanshu Jha
2017-11-03 16:25 ` Martin K. Petersen
0 siblings, 1 reply; 8+ messages in thread
From: Himanshu Jha @ 2017-11-03 16:10 UTC (permalink / raw)
To: Martin K. Petersen
Cc: jejb, linux-scsi, linux-kernel, subbu.seetharaman, ketan.mukadam,
jitendra.bhivare
On Fri, Nov 03, 2017 at 11:25:05AM -0400, Martin K. Petersen wrote:
Hi Martin,
>
> Himanshu,
>
> > Just a reminder, is my patch in our queue ?
>
> It is not. It needs a review/ack from the driver maintainers.
What about Kyle Fortin's review ?
> --
> Martin K. Petersen Oracle Linux Engineering
Thanks
Himanshu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] scsi: be2iscsi: Use kasprintf
2017-11-03 16:10 ` Himanshu Jha
@ 2017-11-03 16:25 ` Martin K. Petersen
0 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2017-11-03 16:25 UTC (permalink / raw)
To: Himanshu Jha
Cc: Martin K. Petersen, jejb, linux-scsi, linux-kernel,
subbu.seetharaman, ketan.mukadam, jitendra.bhivare
Himanshu,
>> It is not. It needs a review/ack from the driver maintainers.
>
> What about Kyle Fortin's review ?
Kyle's review is fine. But when a driver is actively maintained, like
be2iscsi is, I always give ack/nack rights to the relevant maintainers.
In this case that's Jitendra.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH v2] scsi: be2iscsi: Use kasprintf
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
@ 2017-11-06 5:01 ` Jitendra Bhivare
2017-11-07 3:59 ` Martin K. Petersen
2 siblings, 1 reply; 8+ messages in thread
From: Jitendra Bhivare @ 2017-11-06 5:01 UTC (permalink / raw)
To: Himanshu Jha, jejb
Cc: martin.petersen, linux-scsi, linux-kernel,
Subramanian Seetharaman, Ketan Mukadam
> -----Original Message-----
> From: Himanshu Jha [mailto:himanshujha199640@gmail.com]
> Sent: Wednesday, October 11, 2017 9:06 PM
> 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;
> Himanshu Jha <himanshujha199640@gmail.com>
> Subject: [PATCH v2] scsi: be2iscsi: Use kasprintf
>
> 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
Looks good.
- Thanks.
Reviewed-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] scsi: be2iscsi: Use kasprintf
2017-11-06 5:01 ` Jitendra Bhivare
@ 2017-11-07 3:59 ` Martin K. Petersen
0 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2017-11-07 3:59 UTC (permalink / raw)
To: Jitendra Bhivare
Cc: Himanshu Jha, jejb, martin.petersen, linux-scsi, linux-kernel,
Subramanian Seetharaman, Ketan Mukadam
Jitendra,
>> 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>
> Reviewed-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Applied to 4.15/scsi-queue.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-11-07 3:59 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
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.