iscsi-scst: Simplify iscsi_get_initiator_port_transport_id()

From the snprintf() man page:
    
If n is zero, nothing shall be written and s may be a null pointer.

This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7435 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2018-07-23 04:23:26 +00:00
parent cf843cecf3
commit 4c01448dfa

View File

@@ -3950,7 +3950,6 @@ static int iscsi_get_initiator_port_transport_id(struct scst_tgt *tgt,
union iscsi_sid sid;
int tr_id_size;
uint8_t *tr_id;
uint8_t q;
TRACE_ENTRY();
@@ -3965,7 +3964,7 @@ static int iscsi_get_initiator_port_transport_id(struct scst_tgt *tgt,
sid.id.tsih = 0;
tr_id_size = 4 + strlen(sess->initiator_name) + 5 +
snprintf(&q, sizeof(q), "%llx", sid.id64) + 1;
snprintf(NULL, 0, "%llx", sid.id64) + 1;
tr_id_size = (tr_id_size + 3) & -4;
tr_id = kzalloc(tr_id_size, GFP_KERNEL);