linux-stable/drivers/target/iscsi
Guenter Roeck 998da772fd scsi: target: iscsi: Drop unnecessary container_of()
The structure pointer passed to container_of() is never NULL; that was
already checked. That means that the result of container_of() operations
on it is also never NULL, even though se_node_acl is the first element
of the structure embedding it. On top of that, it is misleading to perform
a NULL check on the result of container_of() because the position of the
contained element could change, which would make the test invalid.
Remove the unnecessary NULL check.

As it turns out, the container_of operation was only made for the purpose
of the NULL check. If the container_of is actually needed, it is repeated
later. Remove the container_of operation as well.

The NULL check was identified and removed with the following Coccinelle
script.

@@
type t;
identifier v;
statement s;
@@

<+...
(
  t v = container_of(...);
|
  v = container_of(...);
)
  ...
  when != v
- if (\( !v \| v == NULL \) ) s
...+>

Link: https://lore.kernel.org/r/20210510040817.2050266-1-linux@roeck-us.net
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Hou Pu <houpu@bytedance.com>
Cc: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-05-14 22:40:45 -04:00
..
cxgbit scsi: target: cxgbit: Unmap DMA buffer before calling target_execute_cmd() 2021-05-14 22:28:17 -04:00
iscsi_target.c Merge branch '5.12/scsi-fixes' into 5.13/scsi-staging 2021-04-12 21:41:54 -04:00
iscsi_target.h scsi: target: iscsi: Avoid in_interrupt() usage in iscsit_close_session() 2021-01-22 20:25:25 -05:00
iscsi_target_auth.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
iscsi_target_auth.h scsi: target: iscsi: tie the challenge length to the hash digest size 2019-11-06 00:13:24 -05:00
iscsi_target_configfs.c scsi: target: iscsi: Initialize arrays at declaration time 2021-03-09 23:47:18 -05:00
iscsi_target_datain_values.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
iscsi_target_datain_values.h
iscsi_target_device.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
iscsi_target_device.h
iscsi_target_erl0.c scsi: target: iscsi: Avoid in_interrupt() usage in iscsit_close_session() 2021-01-22 20:25:25 -05:00
iscsi_target_erl0.h
iscsi_target_erl1.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
iscsi_target_erl1.h
iscsi_target_erl2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
iscsi_target_erl2.h
iscsi_target_login.c scsi: target: iscsi: Fix typo in comment 2021-01-20 21:37:35 -05:00
iscsi_target_login.h scsi: target: iscsi: Fix hang in iscsit_access_np() when getting tpg->np_login_sem 2020-09-02 21:08:22 -04:00
iscsi_target_nego.c scsi: target: iscsi: Drop unnecessary container_of() 2021-05-14 22:40:45 -04:00
iscsi_target_nego.h
iscsi_target_nodeattrib.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
iscsi_target_nodeattrib.h
iscsi_target_parameters.c scsi: target: iscsi: Switch to kmemdup_nul() 2021-05-10 13:24:03 -04:00
iscsi_target_parameters.h scsi: target: remove unused extension parameters 2019-10-22 22:14:25 -04:00
iscsi_target_seq_pdu_list.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
iscsi_target_seq_pdu_list.h
iscsi_target_stat.c scsi: target: iscsi: Remove unused macro ISCSI_INST_LAST_FAILURE_TYPE 2021-03-09 23:47:18 -05:00
iscsi_target_tmr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
iscsi_target_tmr.h
iscsi_target_tpg.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
iscsi_target_tpg.h
iscsi_target_transport.c scsi: target: Make iscsit_register_transport() return void 2020-08-04 20:56:56 -04:00
iscsi_target_util.c scsi: target: iscsi: Remove unused macro PRINT_BUF 2021-03-09 23:47:18 -05:00
iscsi_target_util.h scsi: target: iscsi: Redo iscsit_check_session_usage_count() return code 2021-01-22 20:25:25 -05:00
Kconfig net: add sock_set_reuseaddr 2020-05-28 11:11:44 -07:00
Makefile