Re: [PATCH] scsi:libiscsi: remove unnecessary memset in iscsi_conn_setup

5 views
Skip to first unread message

Wenchao Hao

unread,
Mar 16, 2022, 5:03:04 AM3/16/22
to Lee Duncan, Chris Leech, James E . J . Bottomley, Martin K . Petersen, Mike Christie, Wu Bo, open-...@googlegroups.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, Zhiqiang Liu, Feilong Lin
cc open-...@googlegroups.com linux...@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 <haowe...@huawei.com>
> Reviewed-by: Wu Bo <wub...@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;
>

Mike Christie

unread,
Mar 16, 2022, 10:26:28 AM3/16/22
to Wenchao Hao, Lee Duncan, Chris Leech, James E . J . Bottomley, Martin K . Petersen, Wu Bo, open-...@googlegroups.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, Zhiqiang Liu, Feilong Lin
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).

Wenchao Hao

unread,
Mar 16, 2022, 9:50:19 PM3/16/22
to Lee Duncan, Chris Leech, James E . J . Bottomley, Mike Christie, Martin K . Petersen, open-...@googlegroups.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, Zhiqiang Liu, Wu Bo, linfe...@huawei.com, 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 <haowe...@huawei.com>
Reviewed-by: Wu Bo <wub...@huawei.com>
Reviewed-by: Lee Duncan <ldu...@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

Mike Christie

unread,
Mar 17, 2022, 11:08:58 AM3/17/22
to Wenchao Hao, Lee Duncan, Chris Leech, James E . J . Bottomley, Martin K . Petersen, open-...@googlegroups.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, Zhiqiang Liu, Wu Bo, linfe...@huawei.com
Reviewed-by: Mike Christie <michael....@oracle.com>

Lee Duncan

unread,
Mar 17, 2022, 11:35:07 AM3/17/22
to Wenchao Hao, Chris Leech, James E . J . Bottomley, Mike Christie, Martin K . Petersen, open-...@googlegroups.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, Zhiqiang Liu, Wu Bo, linfe...@huawei.com
Reviewed-by: Lee Duncan <ldu...@suse.com>

Martin K. Petersen

unread,
Mar 29, 2022, 11:02:54 PM3/29/22
to Wenchao Hao, Lee Duncan, Chris Leech, James E . J . Bottomley, Mike Christie, Martin K . Petersen, open-...@googlegroups.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, Zhiqiang Liu, Wu Bo, linfe...@huawei.com

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
Reply all
Reply to author
Forward
0 new messages