All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup
@ 2022-03-17 15:01 Wenchao Hao
  2022-03-17 15:08 ` Mike Christie
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Wenchao Hao @ 2022-03-17 15:01 UTC (permalink / raw)
  To: Lee Duncan, Chris Leech, James E . J . Bottomley, Mike Christie,
	Martin K . Petersen, open-iscsi, linux-scsi, linux-kernel
  Cc: Zhiqiang Liu, Wu Bo, linfeilong, Wenchao Hao

iscsi_cls_conn is alloced by kzalloc(), the whole iscsi_cls_conn is
zero filled already including the dd_data. So it is unnecessary to
call memset again.

Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
Reviewed-by: Wu Bo <wubo40@huawei.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
---
 drivers/scsi/libiscsi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index d09926e6c8a8..cf4211c6500d 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -3045,7 +3045,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size,
 	if (!cls_conn)
 		return NULL;
 	conn = cls_conn->dd_data;
-	memset(conn, 0, sizeof(*conn) + dd_size);
 
 	conn->dd_data = cls_conn->dd_data + sizeof(*conn);
 	conn->session = session;
-- 
2.32.0


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

* Re: [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup
  2022-03-17 15:01 [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup Wenchao Hao
@ 2022-03-17 15:08 ` Mike Christie
  2022-03-17 15:34 ` Lee Duncan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Mike Christie @ 2022-03-17 15:08 UTC (permalink / raw)
  To: Wenchao Hao, Lee Duncan, Chris Leech, James E . J . Bottomley,
	Martin K . Petersen, open-iscsi, linux-scsi, linux-kernel
  Cc: Zhiqiang Liu, Wu Bo, linfeilong

On 3/17/22 10:01 AM, Wenchao Hao wrote:
> iscsi_cls_conn is alloced by kzalloc(), the whole iscsi_cls_conn is
> zero filled already including the dd_data. So it is unnecessary to
> call memset again.
> 
> Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
> Reviewed-by: Wu Bo <wubo40@huawei.com>
> Reviewed-by: Lee Duncan <lduncan@suse.com>
> ---
>  drivers/scsi/libiscsi.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
> index d09926e6c8a8..cf4211c6500d 100644
> --- a/drivers/scsi/libiscsi.c
> +++ b/drivers/scsi/libiscsi.c
> @@ -3045,7 +3045,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size,
>  	if (!cls_conn)
>  		return NULL;
>  	conn = cls_conn->dd_data;
> -	memset(conn, 0, sizeof(*conn) + dd_size);
>  
>  	conn->dd_data = cls_conn->dd_data + sizeof(*conn);
>  	conn->session = session;

Reviewed-by: Mike Christie <michael.christie@oracle.com>

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

* Re: [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup
  2022-03-17 15:01 [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup Wenchao Hao
  2022-03-17 15:08 ` Mike Christie
@ 2022-03-17 15:34 ` Lee Duncan
  2022-03-30  3:02 ` Martin K. Petersen
  2022-04-07 13:35 ` Martin K. Petersen
  3 siblings, 0 replies; 7+ messages in thread
From: Lee Duncan @ 2022-03-17 15:34 UTC (permalink / raw)
  To: Wenchao Hao, Chris Leech, James E . J . Bottomley, Mike Christie,
	Martin K . Petersen, open-iscsi, linux-scsi, linux-kernel
  Cc: Zhiqiang Liu, Wu Bo, linfeilong

On 3/17/22 08:01, Wenchao Hao wrote:
> iscsi_cls_conn is alloced by kzalloc(), the whole iscsi_cls_conn is
> zero filled already including the dd_data. So it is unnecessary to
> call memset again.
> 
> Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
> Reviewed-by: Wu Bo <wubo40@huawei.com>
> Reviewed-by: Lee Duncan <lduncan@suse.com>
> ---
>   drivers/scsi/libiscsi.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
> index d09926e6c8a8..cf4211c6500d 100644
> --- a/drivers/scsi/libiscsi.c
> +++ b/drivers/scsi/libiscsi.c
> @@ -3045,7 +3045,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size,
>   	if (!cls_conn)
>   		return NULL;
>   	conn = cls_conn->dd_data;
> -	memset(conn, 0, sizeof(*conn) + dd_size);
>   
>   	conn->dd_data = cls_conn->dd_data + sizeof(*conn);
>   	conn->session = session;

Reviewed-by: Lee Duncan <lduncan@suse.com>


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

* Re: [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup
  2022-03-17 15:01 [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup Wenchao Hao
  2022-03-17 15:08 ` Mike Christie
  2022-03-17 15:34 ` Lee Duncan
@ 2022-03-30  3:02 ` Martin K. Petersen
  2022-04-07 13:35 ` Martin K. Petersen
  3 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2022-03-30  3:02 UTC (permalink / raw)
  To: Wenchao Hao
  Cc: Lee Duncan, Chris Leech, James E . J . Bottomley, Mike Christie,
	Martin K . Petersen, open-iscsi, linux-scsi, linux-kernel,
	Zhiqiang Liu, Wu Bo, linfeilong


Wenchao,

> iscsi_cls_conn is alloced by kzalloc(), the whole iscsi_cls_conn is
> zero filled already including the dd_data. So it is unnecessary to
> call memset again.

Applied to 5.18/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup
  2022-03-17 15:01 [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup Wenchao Hao
                   ` (2 preceding siblings ...)
  2022-03-30  3:02 ` Martin K. Petersen
@ 2022-04-07 13:35 ` Martin K. Petersen
  3 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2022-04-07 13:35 UTC (permalink / raw)
  To: linux-scsi; +Cc: Martin K . Petersen, Wu Bo, Zhiqiang Liu, linfeilong

On Thu, 17 Mar 2022 11:01:16 -0400, Wenchao Hao wrote:

> iscsi_cls_conn is alloced by kzalloc(), the whole iscsi_cls_conn is
> zero filled already including the dd_data. So it is unnecessary to
> call memset again.
> 
> 

Applied to 5.18/scsi-fixes, thanks!

[1/1] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup
      https://git.kernel.org/mkp/scsi/c/ebfe3e0c5e80

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup
  2022-03-16  9:02 ` Wenchao Hao
@ 2022-03-16 14:26   ` Mike Christie
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Christie @ 2022-03-16 14:26 UTC (permalink / raw)
  To: Wenchao Hao, Lee Duncan, Chris Leech, James E . J . Bottomley,
	Martin K . Petersen
  Cc: Wu Bo, open-iscsi, linux-scsi, linux-kernel, Zhiqiang Liu, Feilong Lin

On 3/16/22 4:02 AM, Wenchao Hao wrote:
> cc open-iscsi@googlegroups.com linux-scsi@vger.kernel.org
> 
> On 2022/3/17 6:09, Wenchao Hao wrote:
>> iscsi_cls_conn is alloced by kzalloc(), the whole iscsi_cls_conn is
>> zero filled already including the dd_data. So it is unnecessary to
>> call memset again.
>>
>> Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
>> Reviewed-by: Wu Bo <wubo40@huawei.com>
>> ---
>>   drivers/scsi/libiscsi.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
>> index d09926e6c8a8..cf4211c6500d 100644
>> --- a/drivers/scsi/libiscsi.c
>> +++ b/drivers/scsi/libiscsi.c
>> @@ -3045,7 +3045,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size,
>>       if (!cls_conn)
>>           return NULL;
>>       conn = cls_conn->dd_data;
>> -    memset(conn, 0, sizeof(*conn) + dd_size);
>>         conn->dd_data = cls_conn->dd_data + sizeof(*conn);
>>       conn->session = session;
>>
> 

The removal of the memset is ok, but you should resend the original
to the list because the formatting got messed up, and I think Martin
can't track this (The patch doesn't show up in patchwork/lore type of
things).


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

* Re: [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup
       [not found] <20220316220936.191013-1-haowenchao@huawei.com>
@ 2022-03-16  9:02 ` Wenchao Hao
  2022-03-16 14:26   ` Mike Christie
  0 siblings, 1 reply; 7+ messages in thread
From: Wenchao Hao @ 2022-03-16  9:02 UTC (permalink / raw)
  To: Lee Duncan, Chris Leech, James E . J . Bottomley,
	Martin K . Petersen, Mike Christie
  Cc: Wu Bo, open-iscsi, linux-scsi, linux-kernel, Zhiqiang Liu, Feilong Lin

cc open-iscsi@googlegroups.com linux-scsi@vger.kernel.org

On 2022/3/17 6:09, Wenchao Hao wrote:
> iscsi_cls_conn is alloced by kzalloc(), the whole iscsi_cls_conn is
> zero filled already including the dd_data. So it is unnecessary to
> call memset again.
> 
> Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
> Reviewed-by: Wu Bo <wubo40@huawei.com>
> ---
>   drivers/scsi/libiscsi.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
> index d09926e6c8a8..cf4211c6500d 100644
> --- a/drivers/scsi/libiscsi.c
> +++ b/drivers/scsi/libiscsi.c
> @@ -3045,7 +3045,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size,
>   	if (!cls_conn)
>   		return NULL;
>   	conn = cls_conn->dd_data;
> -	memset(conn, 0, sizeof(*conn) + dd_size);
>   
>   	conn->dd_data = cls_conn->dd_data + sizeof(*conn);
>   	conn->session = session;
> 


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

end of thread, other threads:[~2022-04-07 13:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-17 15:01 [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup Wenchao Hao
2022-03-17 15:08 ` Mike Christie
2022-03-17 15:34 ` Lee Duncan
2022-03-30  3:02 ` Martin K. Petersen
2022-04-07 13:35 ` Martin K. Petersen
     [not found] <20220316220936.191013-1-haowenchao@huawei.com>
2022-03-16  9:02 ` Wenchao Hao
2022-03-16 14:26   ` Mike Christie

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.