diff mbox series

scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup

Message ID 20220317150116.194140-1-haowenchao@huawei.com
State New
Headers show
Series scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup | expand

Commit Message

Wenchao Hao March 17, 2022, 3:01 p.m. UTC
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(-)

Comments

Mike Christie March 17, 2022, 3:08 p.m. UTC | #1
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>
Martin K. Petersen March 30, 2022, 3:02 a.m. UTC | #2
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 April 7, 2022, 1:35 p.m. UTC | #3
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
diff mbox series

Patch

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;