aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/scsi/fc_encode.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index c8968d31c610..ab2260cb149c 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -111,6 +111,7 @@ static inline int fc_ct_fill(struct fc_lport *lport,
111 enum fc_fh_type *fh_type) 111 enum fc_fh_type *fh_type)
112{ 112{
113 struct fc_ct_req *ct; 113 struct fc_ct_req *ct;
114 size_t len;
114 115
115 switch (op) { 116 switch (op) {
116 case FC_NS_GPN_FT: 117 case FC_NS_GPN_FT:
@@ -138,22 +139,22 @@ static inline int fc_ct_fill(struct fc_lport *lport,
138 break; 139 break;
139 140
140 case FC_NS_RSPN_ID: 141 case FC_NS_RSPN_ID:
141 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn)); 142 len = strnlen(fc_host_symbolic_name(lport->host), 255);
143 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len);
142 hton24(ct->payload.spn.fr_fid.fp_fid, 144 hton24(ct->payload.spn.fr_fid.fp_fid,
143 fc_host_port_id(lport->host)); 145 fc_host_port_id(lport->host));
144 strncpy(ct->payload.spn.fr_name, 146 strncpy(ct->payload.spn.fr_name,
145 fc_host_symbolic_name(lport->host), 255); 147 fc_host_symbolic_name(lport->host), len);
146 ct->payload.spn.fr_name_len = 148 ct->payload.spn.fr_name_len = len;
147 strnlen(ct->payload.spn.fr_name, 255);
148 break; 149 break;
149 150
150 case FC_NS_RSNN_NN: 151 case FC_NS_RSNN_NN:
151 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn)); 152 len = strnlen(fc_host_symbolic_name(lport->host), 255);
153 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len);
152 put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn); 154 put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn);
153 strncpy(ct->payload.snn.fr_name, 155 strncpy(ct->payload.snn.fr_name,
154 fc_host_symbolic_name(lport->host), 255); 156 fc_host_symbolic_name(lport->host), len);
155 ct->payload.snn.fr_name_len = 157 ct->payload.snn.fr_name_len = len;
156 strnlen(ct->payload.snn.fr_name, 255);
157 break; 158 break;
158 159
159 default: 160 default: