diff options
author | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2017-11-21 01:12:43 +0100 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2018-01-12 15:07:09 -0800 |
commit | 094bb5d766cfcdae47e332c6d6713c7029241be1 (patch) | |
tree | 45cb641e8bf2701941c24499febbfad2fdb42100 /drivers/target/target_core_fabric_lib.c | |
parent | 30a7acd573899fd8b8ac39236eff6468b195ac7d (diff) | |
download | linux-stable-094bb5d766cfcdae47e332c6d6713c7029241be1.tar.gz linux-stable-094bb5d766cfcdae47e332c6d6713c7029241be1.tar.bz2 linux-stable-094bb5d766cfcdae47e332c6d6713c7029241be1.zip |
target-core: don't use "const char*" for a buffer that is written to
iscsi_parse_pr_out_transport_id launders the const away via a call to
strstr(), and then modifies the buffer (writing a nul byte) through
the return value. It's cleaner to be honest and simply declare the
parameter as "char*", fixing up the call chain, and allowing us to
drop the cast in the return statement.
Amusingly, the two current callers found it necessary to cast a
non-const pointer to a const.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_fabric_lib.c')
-rw-r--r-- | drivers/target/target_core_fabric_lib.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c index 508da345b73f..71a80257a052 100644 --- a/drivers/target/target_core_fabric_lib.c +++ b/drivers/target/target_core_fabric_lib.c @@ -273,7 +273,7 @@ static int iscsi_get_pr_transport_id_len( static char *iscsi_parse_pr_out_transport_id( struct se_portal_group *se_tpg, - const char *buf, + char *buf, u32 *out_tid_len, char **port_nexus_ptr) { @@ -356,7 +356,7 @@ static char *iscsi_parse_pr_out_transport_id( } } - return (char *)&buf[4]; + return &buf[4]; } int target_get_pr_transport_id_len(struct se_node_acl *nacl, @@ -405,7 +405,7 @@ int target_get_pr_transport_id(struct se_node_acl *nacl, } const char *target_parse_pr_out_transport_id(struct se_portal_group *tpg, - const char *buf, u32 *out_tid_len, char **port_nexus_ptr) + char *buf, u32 *out_tid_len, char **port_nexus_ptr) { u32 offset; |