linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix warning by coccicheck
@ 2015-10-23 20:03 Punit Vara
  2015-10-23 20:03 ` [PATCH 1/2] scsi: lpfc: Use kzalloc instead of kmalloc Punit Vara
  2015-10-23 20:03 ` [PATCH 2/2] scsi: remove useless casting value returned by kmalloc to structure Punit Vara
  0 siblings, 2 replies; 6+ messages in thread
From: Punit Vara @ 2015-10-23 20:03 UTC (permalink / raw)
  To: JBottomley
  Cc: don.brace, storagedev, iss_storagedev, linux-scsi, linux-kernel,
	Punit Vara


Punit Vara (2):
  scsi: lpfc: Use kzalloc instead of kmalloc
  scsi: remove useless casting value returned by kmalloc to structure

 drivers/scsi/hpsa.c          | 3 +--
 drivers/scsi/lpfc/lpfc_els.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

-- 
2.5.3

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] scsi: lpfc: Use kzalloc instead of kmalloc
  2015-10-23 20:03 [PATCH 0/2] Fix warning by coccicheck Punit Vara
@ 2015-10-23 20:03 ` Punit Vara
  2015-10-23 23:26   ` Matthew R. Ochs
  2015-10-23 20:03 ` [PATCH 2/2] scsi: remove useless casting value returned by kmalloc to structure Punit Vara
  1 sibling, 1 reply; 6+ messages in thread
From: Punit Vara @ 2015-10-23 20:03 UTC (permalink / raw)
  To: JBottomley
  Cc: don.brace, storagedev, iss_storagedev, linux-scsi, linux-kernel,
	Punit Vara

This patch is to the lpfc_els.c which resolves following warning
reported by coccicheck:

WARNING: kzalloc should be used for rdp_context, instead of
kmalloc/memset

Signed-off-by: Punit Vara <punitvara@gmail.com>
---
 drivers/scsi/lpfc/lpfc_els.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 36bf58b..422c800 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -4990,7 +4990,7 @@ lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
 	if (RDP_NPORT_ID_SIZE !=
 			be32_to_cpu(rdp_req->nport_id_desc.length))
 		goto rjt_logerr;
-	rdp_context = kmalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
+	rdp_context = kzalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
 	if (!rdp_context) {
 		rjt_err = LSRJT_UNABLE_TPC;
 		goto error;
-- 
2.5.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] scsi: remove useless casting value returned by kmalloc to structure
  2015-10-23 20:03 [PATCH 0/2] Fix warning by coccicheck Punit Vara
  2015-10-23 20:03 ` [PATCH 1/2] scsi: lpfc: Use kzalloc instead of kmalloc Punit Vara
@ 2015-10-23 20:03 ` Punit Vara
  2015-10-23 23:27   ` Matthew R. Ochs
  1 sibling, 1 reply; 6+ messages in thread
From: Punit Vara @ 2015-10-23 20:03 UTC (permalink / raw)
  To: JBottomley
  Cc: don.brace, storagedev, iss_storagedev, linux-scsi, linux-kernel,
	Punit Vara

This is the patch to the hpsa.c file that resolves following warning
reported by coccicheck:

WARNING: casting value returned by memory allocation function to
(BIG_IOCTL_Command_struct *) is useless.

Signed-off-by: Punit Vara <punitvara@gmail.com>
---
 drivers/scsi/hpsa.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 40669f8..8d971b3 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6027,8 +6027,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
 		return -EINVAL;
 	if (!capable(CAP_SYS_RAWIO))
 		return -EPERM;
-	ioc = (BIG_IOCTL_Command_struct *)
-	    kmalloc(sizeof(*ioc), GFP_KERNEL);
+	ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
 	if (!ioc) {
 		status = -ENOMEM;
 		goto cleanup1;
-- 
2.5.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] scsi: lpfc: Use kzalloc instead of kmalloc
  2015-10-23 20:03 ` [PATCH 1/2] scsi: lpfc: Use kzalloc instead of kmalloc Punit Vara
@ 2015-10-23 23:26   ` Matthew R. Ochs
  2015-10-25  9:17     ` punit vara
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew R. Ochs @ 2015-10-23 23:26 UTC (permalink / raw)
  To: Punit Vara
  Cc: JBottomley, don.brace, storagedev, iss_storagedev, linux-scsi,
	linux-kernel

Hi Punit,

Aren't you missing the removal of the memset() as part of this conversion?


-matt

> On Oct 23, 2015, at 3:03 PM, Punit Vara <punitvara@gmail.com> wrote:
> 
> This patch is to the lpfc_els.c which resolves following warning
> reported by coccicheck:
> 
> WARNING: kzalloc should be used for rdp_context, instead of
> kmalloc/memset
> 
> Signed-off-by: Punit Vara <punitvara@gmail.com>
> ---
> drivers/scsi/lpfc/lpfc_els.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
> index 36bf58b..422c800 100644
> --- a/drivers/scsi/lpfc/lpfc_els.c
> +++ b/drivers/scsi/lpfc/lpfc_els.c
> @@ -4990,7 +4990,7 @@ lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
> 	if (RDP_NPORT_ID_SIZE !=
> 			be32_to_cpu(rdp_req->nport_id_desc.length))
> 		goto rjt_logerr;
> -	rdp_context = kmalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
> +	rdp_context = kzalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
> 	if (!rdp_context) {
> 		rjt_err = LSRJT_UNABLE_TPC;
> 		goto error;


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] scsi: remove useless casting value returned by kmalloc to structure
  2015-10-23 20:03 ` [PATCH 2/2] scsi: remove useless casting value returned by kmalloc to structure Punit Vara
@ 2015-10-23 23:27   ` Matthew R. Ochs
  0 siblings, 0 replies; 6+ messages in thread
From: Matthew R. Ochs @ 2015-10-23 23:27 UTC (permalink / raw)
  To: Punit Vara
  Cc: JBottomley, don.brace, storagedev, iss_storagedev, linux-scsi,
	linux-kernel

Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] scsi: lpfc: Use kzalloc instead of kmalloc
  2015-10-23 23:26   ` Matthew R. Ochs
@ 2015-10-25  9:17     ` punit vara
  0 siblings, 0 replies; 6+ messages in thread
From: punit vara @ 2015-10-25  9:17 UTC (permalink / raw)
  To: Matthew R. Ochs
  Cc: JBottomley, don.brace, storagedev, iss_storagedev, linux-scsi,
	linux-kernel

On Sat, Oct 24, 2015 at 4:56 AM, Matthew R. Ochs
<mrochs@linux.vnet.ibm.com> wrote:
> Hi Punit,
>
> Aren't you missing the removal of the memset() as part of this conversion?
>
>
> -matt
>
>> On Oct 23, 2015, at 3:03 PM, Punit Vara <punitvara@gmail.com> wrote:
>>
>> This patch is to the lpfc_els.c which resolves following warning
>> reported by coccicheck:
>>
>> WARNING: kzalloc should be used for rdp_context, instead of
>> kmalloc/memset
>>
>> Signed-off-by: Punit Vara <punitvara@gmail.com>
>> ---
>> drivers/scsi/lpfc/lpfc_els.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
>> index 36bf58b..422c800 100644
>> --- a/drivers/scsi/lpfc/lpfc_els.c
>> +++ b/drivers/scsi/lpfc/lpfc_els.c
>> @@ -4990,7 +4990,7 @@ lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
>>       if (RDP_NPORT_ID_SIZE !=
>>                       be32_to_cpu(rdp_req->nport_id_desc.length))
>>               goto rjt_logerr;
>> -     rdp_context = kmalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
>> +     rdp_context = kzalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
>>       if (!rdp_context) {
>>               rjt_err = LSRJT_UNABLE_TPC;
>>               goto error;
>
Thanks for reviewing my patches.
Can I send more patches ? my all previous patches already reviewed by
you . Should I wait to apply this patch to tree or i can send new
patch set ? Please suggest me sir.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-25  9:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-23 20:03 [PATCH 0/2] Fix warning by coccicheck Punit Vara
2015-10-23 20:03 ` [PATCH 1/2] scsi: lpfc: Use kzalloc instead of kmalloc Punit Vara
2015-10-23 23:26   ` Matthew R. Ochs
2015-10-25  9:17     ` punit vara
2015-10-23 20:03 ` [PATCH 2/2] scsi: remove useless casting value returned by kmalloc to structure Punit Vara
2015-10-23 23:27   ` Matthew R. Ochs

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).