1 From e7f7b6f38a44697428f5a2e7c606de028df2b0e3 Mon Sep 17 00:00:00 2001
2 From: Silvio Cesare <silvio.cesare@gmail.com>
3 Date: Thu, 21 Mar 2019 09:44:32 -0700
4 Subject: scsi: lpfc: change snprintf to scnprintf for possible overflow
6 From: Silvio Cesare <silvio.cesare@gmail.com>
8 commit e7f7b6f38a44697428f5a2e7c606de028df2b0e3 upstream.
10 Change snprintf to scnprintf. There are generally two cases where using
11 snprintf causes problems.
13 1) Uses of size += snprintf(buf, SIZE - size, fmt, ...)
14 In this case, if snprintf would have written more characters than what the
15 buffer size (SIZE) is, then size will end up larger than SIZE. In later
16 uses of snprintf, SIZE - size will result in a negative number, leading
17 to problems. Note that size might already be too large by using
18 size = snprintf before the code reaches a case of size += snprintf.
20 2) If size is ultimately used as a length parameter for a copy back to user
21 space, then it will potentially allow for a buffer overflow and information
22 disclosure when size is greater than SIZE. When the size is used to index
23 the buffer directly, we can have memory corruption. This also means when
24 size = snprintf... is used, it may also cause problems since size may become
25 large. Copying to userspace is mitigated by the HARDENED_USERCOPY kernel
28 The solution to these issues is to use scnprintf which returns the number of
29 characters actually written to the buffer, so the size variable will never
32 Signed-off-by: Silvio Cesare <silvio.cesare@gmail.com>
33 Signed-off-by: Willy Tarreau <w@1wt.eu>
34 Signed-off-by: James Smart <james.smart@broadcom.com>
35 Cc: Dick Kennedy <dick.kennedy@broadcom.com>
36 Cc: Dan Carpenter <dan.carpenter@oracle.com>
37 Cc: Kees Cook <keescook@chromium.org>
38 Cc: Will Deacon <will.deacon@arm.com>
39 Cc: Greg KH <greg@kroah.com>
40 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
41 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
44 drivers/scsi/lpfc/lpfc_attr.c | 192 ++++++++--------
45 drivers/scsi/lpfc/lpfc_ct.c | 12 -
46 drivers/scsi/lpfc/lpfc_debugfs.c | 455 +++++++++++++++++++--------------------
47 drivers/scsi/lpfc/lpfc_debugfs.h | 6
48 4 files changed, 336 insertions(+), 329 deletions(-)
50 --- a/drivers/scsi/lpfc/lpfc_attr.c
51 +++ b/drivers/scsi/lpfc/lpfc_attr.c
52 @@ -117,7 +117,7 @@ static ssize_t
53 lpfc_drvr_version_show(struct device *dev, struct device_attribute *attr,
56 - return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n");
57 + return scnprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n");
61 @@ -137,9 +137,9 @@ lpfc_enable_fip_show(struct device *dev,
62 struct lpfc_hba *phba = vport->phba;
64 if (phba->hba_flag & HBA_FIP_SUPPORT)
65 - return snprintf(buf, PAGE_SIZE, "1\n");
66 + return scnprintf(buf, PAGE_SIZE, "1\n");
68 - return snprintf(buf, PAGE_SIZE, "0\n");
69 + return scnprintf(buf, PAGE_SIZE, "0\n");
73 @@ -517,14 +517,15 @@ lpfc_bg_info_show(struct device *dev, st
74 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
75 struct lpfc_hba *phba = vport->phba;
77 - if (phba->cfg_enable_bg)
78 + if (phba->cfg_enable_bg) {
79 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED)
80 - return snprintf(buf, PAGE_SIZE, "BlockGuard Enabled\n");
81 + return scnprintf(buf, PAGE_SIZE,
82 + "BlockGuard Enabled\n");
84 - return snprintf(buf, PAGE_SIZE,
85 + return scnprintf(buf, PAGE_SIZE,
86 "BlockGuard Not Supported\n");
88 - return snprintf(buf, PAGE_SIZE,
90 + return scnprintf(buf, PAGE_SIZE,
91 "BlockGuard Disabled\n");
94 @@ -536,7 +537,7 @@ lpfc_bg_guard_err_show(struct device *de
95 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
96 struct lpfc_hba *phba = vport->phba;
98 - return snprintf(buf, PAGE_SIZE, "%llu\n",
99 + return scnprintf(buf, PAGE_SIZE, "%llu\n",
100 (unsigned long long)phba->bg_guard_err_cnt);
103 @@ -548,7 +549,7 @@ lpfc_bg_apptag_err_show(struct device *d
104 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
105 struct lpfc_hba *phba = vport->phba;
107 - return snprintf(buf, PAGE_SIZE, "%llu\n",
108 + return scnprintf(buf, PAGE_SIZE, "%llu\n",
109 (unsigned long long)phba->bg_apptag_err_cnt);
112 @@ -560,7 +561,7 @@ lpfc_bg_reftag_err_show(struct device *d
113 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
114 struct lpfc_hba *phba = vport->phba;
116 - return snprintf(buf, PAGE_SIZE, "%llu\n",
117 + return scnprintf(buf, PAGE_SIZE, "%llu\n",
118 (unsigned long long)phba->bg_reftag_err_cnt);
121 @@ -578,7 +579,7 @@ lpfc_info_show(struct device *dev, struc
123 struct Scsi_Host *host = class_to_shost(dev);
125 - return snprintf(buf, PAGE_SIZE, "%s\n",lpfc_info(host));
126 + return scnprintf(buf, PAGE_SIZE, "%s\n", lpfc_info(host));
130 @@ -597,7 +598,7 @@ lpfc_serialnum_show(struct device *dev,
131 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
132 struct lpfc_hba *phba = vport->phba;
134 - return snprintf(buf, PAGE_SIZE, "%s\n",phba->SerialNumber);
135 + return scnprintf(buf, PAGE_SIZE, "%s\n", phba->SerialNumber);
139 @@ -619,7 +620,7 @@ lpfc_temp_sensor_show(struct device *dev
140 struct Scsi_Host *shost = class_to_shost(dev);
141 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
142 struct lpfc_hba *phba = vport->phba;
143 - return snprintf(buf, PAGE_SIZE, "%d\n",phba->temp_sensor_support);
144 + return scnprintf(buf, PAGE_SIZE, "%d\n", phba->temp_sensor_support);
148 @@ -638,7 +639,7 @@ lpfc_modeldesc_show(struct device *dev,
149 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
150 struct lpfc_hba *phba = vport->phba;
152 - return snprintf(buf, PAGE_SIZE, "%s\n",phba->ModelDesc);
153 + return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelDesc);
157 @@ -657,7 +658,7 @@ lpfc_modelname_show(struct device *dev,
158 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
159 struct lpfc_hba *phba = vport->phba;
161 - return snprintf(buf, PAGE_SIZE, "%s\n",phba->ModelName);
162 + return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelName);
166 @@ -676,7 +677,7 @@ lpfc_programtype_show(struct device *dev
167 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
168 struct lpfc_hba *phba = vport->phba;
170 - return snprintf(buf, PAGE_SIZE, "%s\n",phba->ProgramType);
171 + return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ProgramType);
175 @@ -694,7 +695,7 @@ lpfc_mlomgmt_show(struct device *dev, st
176 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata;
177 struct lpfc_hba *phba = vport->phba;
179 - return snprintf(buf, PAGE_SIZE, "%d\n",
180 + return scnprintf(buf, PAGE_SIZE, "%d\n",
181 (phba->sli.sli_flag & LPFC_MENLO_MAINT));
184 @@ -714,7 +715,7 @@ lpfc_vportnum_show(struct device *dev, s
185 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
186 struct lpfc_hba *phba = vport->phba;
188 - return snprintf(buf, PAGE_SIZE, "%s\n",phba->Port);
189 + return scnprintf(buf, PAGE_SIZE, "%s\n", phba->Port);
193 @@ -742,10 +743,10 @@ lpfc_fwrev_show(struct device *dev, stru
194 sli_family = phba->sli4_hba.pc_sli4_params.sli_family;
196 if (phba->sli_rev < LPFC_SLI_REV4)
197 - len = snprintf(buf, PAGE_SIZE, "%s, sli-%d\n",
198 + len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d\n",
199 fwrev, phba->sli_rev);
201 - len = snprintf(buf, PAGE_SIZE, "%s, sli-%d:%d:%x\n",
202 + len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d:%d:%x\n",
203 fwrev, phba->sli_rev, if_type, sli_family);
206 @@ -769,7 +770,7 @@ lpfc_hdw_show(struct device *dev, struct
207 lpfc_vpd_t *vp = &phba->vpd;
209 lpfc_jedec_to_ascii(vp->rev.biuRev, hdw);
210 - return snprintf(buf, PAGE_SIZE, "%s\n", hdw);
211 + return scnprintf(buf, PAGE_SIZE, "%s\n", hdw);
215 @@ -790,10 +791,11 @@ lpfc_option_rom_version_show(struct devi
216 char fwrev[FW_REV_STR_SIZE];
218 if (phba->sli_rev < LPFC_SLI_REV4)
219 - return snprintf(buf, PAGE_SIZE, "%s\n", phba->OptionROMVersion);
220 + return scnprintf(buf, PAGE_SIZE, "%s\n",
221 + phba->OptionROMVersion);
223 lpfc_decode_firmware_rev(phba, fwrev, 1);
224 - return snprintf(buf, PAGE_SIZE, "%s\n", fwrev);
225 + return scnprintf(buf, PAGE_SIZE, "%s\n", fwrev);
229 @@ -824,20 +826,20 @@ lpfc_link_state_show(struct device *dev,
232 if (phba->hba_flag & LINK_DISABLED)
233 - len += snprintf(buf + len, PAGE_SIZE-len,
234 + len += scnprintf(buf + len, PAGE_SIZE-len,
235 "Link Down - User disabled\n");
237 - len += snprintf(buf + len, PAGE_SIZE-len,
238 + len += scnprintf(buf + len, PAGE_SIZE-len,
244 - len += snprintf(buf + len, PAGE_SIZE-len, "Link Up - ");
245 + len += scnprintf(buf + len, PAGE_SIZE-len, "Link Up - ");
247 switch (vport->port_state) {
248 case LPFC_LOCAL_CFG_LINK:
249 - len += snprintf(buf + len, PAGE_SIZE-len,
250 + len += scnprintf(buf + len, PAGE_SIZE-len,
251 "Configuring Link\n");
254 @@ -847,38 +849,40 @@ lpfc_link_state_show(struct device *dev,
256 case LPFC_BUILD_DISC_LIST:
258 - len += snprintf(buf + len, PAGE_SIZE - len,
259 + len += scnprintf(buf + len, PAGE_SIZE - len,
262 case LPFC_VPORT_READY:
263 - len += snprintf(buf + len, PAGE_SIZE - len, "Ready\n");
264 + len += scnprintf(buf + len, PAGE_SIZE - len,
268 case LPFC_VPORT_FAILED:
269 - len += snprintf(buf + len, PAGE_SIZE - len, "Failed\n");
270 + len += scnprintf(buf + len, PAGE_SIZE - len,
274 case LPFC_VPORT_UNKNOWN:
275 - len += snprintf(buf + len, PAGE_SIZE - len,
276 + len += scnprintf(buf + len, PAGE_SIZE - len,
280 if (phba->sli.sli_flag & LPFC_MENLO_MAINT)
281 - len += snprintf(buf + len, PAGE_SIZE-len,
282 + len += scnprintf(buf + len, PAGE_SIZE-len,
283 " Menlo Maint Mode\n");
284 else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
285 if (vport->fc_flag & FC_PUBLIC_LOOP)
286 - len += snprintf(buf + len, PAGE_SIZE-len,
287 + len += scnprintf(buf + len, PAGE_SIZE-len,
290 - len += snprintf(buf + len, PAGE_SIZE-len,
291 + len += scnprintf(buf + len, PAGE_SIZE-len,
294 if (vport->fc_flag & FC_FABRIC)
295 - len += snprintf(buf + len, PAGE_SIZE-len,
296 + len += scnprintf(buf + len, PAGE_SIZE-len,
299 - len += snprintf(buf + len, PAGE_SIZE-len,
300 + len += scnprintf(buf + len, PAGE_SIZE-len,
304 @@ -890,28 +894,28 @@ lpfc_link_state_show(struct device *dev,
305 struct lpfc_trunk_link link = phba->trunk_link;
307 if (bf_get(lpfc_conf_trunk_port0, &phba->sli4_hba))
308 - len += snprintf(buf + len, PAGE_SIZE - len,
309 + len += scnprintf(buf + len, PAGE_SIZE - len,
310 "Trunk port 0: Link %s %s\n",
311 (link.link0.state == LPFC_LINK_UP) ?
313 trunk_errmsg[link.link0.fault]);
315 if (bf_get(lpfc_conf_trunk_port1, &phba->sli4_hba))
316 - len += snprintf(buf + len, PAGE_SIZE - len,
317 + len += scnprintf(buf + len, PAGE_SIZE - len,
318 "Trunk port 1: Link %s %s\n",
319 (link.link1.state == LPFC_LINK_UP) ?
321 trunk_errmsg[link.link1.fault]);
323 if (bf_get(lpfc_conf_trunk_port2, &phba->sli4_hba))
324 - len += snprintf(buf + len, PAGE_SIZE - len,
325 + len += scnprintf(buf + len, PAGE_SIZE - len,
326 "Trunk port 2: Link %s %s\n",
327 (link.link2.state == LPFC_LINK_UP) ?
329 trunk_errmsg[link.link2.fault]);
331 if (bf_get(lpfc_conf_trunk_port3, &phba->sli4_hba))
332 - len += snprintf(buf + len, PAGE_SIZE - len,
333 + len += scnprintf(buf + len, PAGE_SIZE - len,
334 "Trunk port 3: Link %s %s\n",
335 (link.link3.state == LPFC_LINK_UP) ?
337 @@ -939,15 +943,15 @@ lpfc_sli4_protocol_show(struct device *d
338 struct lpfc_hba *phba = vport->phba;
340 if (phba->sli_rev < LPFC_SLI_REV4)
341 - return snprintf(buf, PAGE_SIZE, "fc\n");
342 + return scnprintf(buf, PAGE_SIZE, "fc\n");
344 if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL) {
345 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_GE)
346 - return snprintf(buf, PAGE_SIZE, "fcoe\n");
347 + return scnprintf(buf, PAGE_SIZE, "fcoe\n");
348 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC)
349 - return snprintf(buf, PAGE_SIZE, "fc\n");
350 + return scnprintf(buf, PAGE_SIZE, "fc\n");
352 - return snprintf(buf, PAGE_SIZE, "unknown\n");
353 + return scnprintf(buf, PAGE_SIZE, "unknown\n");
357 @@ -967,7 +971,7 @@ lpfc_oas_supported_show(struct device *d
358 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata;
359 struct lpfc_hba *phba = vport->phba;
361 - return snprintf(buf, PAGE_SIZE, "%d\n",
362 + return scnprintf(buf, PAGE_SIZE, "%d\n",
363 phba->sli4_hba.pc_sli4_params.oas_supported);
366 @@ -1025,7 +1029,7 @@ lpfc_num_discovered_ports_show(struct de
367 struct Scsi_Host *shost = class_to_shost(dev);
368 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
370 - return snprintf(buf, PAGE_SIZE, "%d\n",
371 + return scnprintf(buf, PAGE_SIZE, "%d\n",
372 vport->fc_map_cnt + vport->fc_unmap_cnt);
375 @@ -1539,7 +1543,7 @@ lpfc_nport_evt_cnt_show(struct device *d
376 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
377 struct lpfc_hba *phba = vport->phba;
379 - return snprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt);
380 + return scnprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt);
384 @@ -1628,7 +1632,7 @@ lpfc_board_mode_show(struct device *dev,
388 - return snprintf(buf, PAGE_SIZE, "%s\n", state);
389 + return scnprintf(buf, PAGE_SIZE, "%s\n", state);
393 @@ -1854,8 +1858,8 @@ lpfc_max_rpi_show(struct device *dev, st
396 if (lpfc_get_hba_info(phba, NULL, NULL, &cnt, NULL, NULL, NULL))
397 - return snprintf(buf, PAGE_SIZE, "%d\n", cnt);
398 - return snprintf(buf, PAGE_SIZE, "Unknown\n");
399 + return scnprintf(buf, PAGE_SIZE, "%d\n", cnt);
400 + return scnprintf(buf, PAGE_SIZE, "Unknown\n");
404 @@ -1882,8 +1886,8 @@ lpfc_used_rpi_show(struct device *dev, s
407 if (lpfc_get_hba_info(phba, NULL, NULL, &cnt, &acnt, NULL, NULL))
408 - return snprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt));
409 - return snprintf(buf, PAGE_SIZE, "Unknown\n");
410 + return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt));
411 + return scnprintf(buf, PAGE_SIZE, "Unknown\n");
415 @@ -1910,8 +1914,8 @@ lpfc_max_xri_show(struct device *dev, st
418 if (lpfc_get_hba_info(phba, &cnt, NULL, NULL, NULL, NULL, NULL))
419 - return snprintf(buf, PAGE_SIZE, "%d\n", cnt);
420 - return snprintf(buf, PAGE_SIZE, "Unknown\n");
421 + return scnprintf(buf, PAGE_SIZE, "%d\n", cnt);
422 + return scnprintf(buf, PAGE_SIZE, "Unknown\n");
426 @@ -1938,8 +1942,8 @@ lpfc_used_xri_show(struct device *dev, s
429 if (lpfc_get_hba_info(phba, &cnt, &acnt, NULL, NULL, NULL, NULL))
430 - return snprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt));
431 - return snprintf(buf, PAGE_SIZE, "Unknown\n");
432 + return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt));
433 + return scnprintf(buf, PAGE_SIZE, "Unknown\n");
437 @@ -1966,8 +1970,8 @@ lpfc_max_vpi_show(struct device *dev, st
440 if (lpfc_get_hba_info(phba, NULL, NULL, NULL, NULL, &cnt, NULL))
441 - return snprintf(buf, PAGE_SIZE, "%d\n", cnt);
442 - return snprintf(buf, PAGE_SIZE, "Unknown\n");
443 + return scnprintf(buf, PAGE_SIZE, "%d\n", cnt);
444 + return scnprintf(buf, PAGE_SIZE, "Unknown\n");
448 @@ -1994,8 +1998,8 @@ lpfc_used_vpi_show(struct device *dev, s
451 if (lpfc_get_hba_info(phba, NULL, NULL, NULL, NULL, &cnt, &acnt))
452 - return snprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt));
453 - return snprintf(buf, PAGE_SIZE, "Unknown\n");
454 + return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt));
455 + return scnprintf(buf, PAGE_SIZE, "Unknown\n");
459 @@ -2020,10 +2024,10 @@ lpfc_npiv_info_show(struct device *dev,
460 struct lpfc_hba *phba = vport->phba;
462 if (!(phba->max_vpi))
463 - return snprintf(buf, PAGE_SIZE, "NPIV Not Supported\n");
464 + return scnprintf(buf, PAGE_SIZE, "NPIV Not Supported\n");
465 if (vport->port_type == LPFC_PHYSICAL_PORT)
466 - return snprintf(buf, PAGE_SIZE, "NPIV Physical\n");
467 - return snprintf(buf, PAGE_SIZE, "NPIV Virtual (VPI %d)\n", vport->vpi);
468 + return scnprintf(buf, PAGE_SIZE, "NPIV Physical\n");
469 + return scnprintf(buf, PAGE_SIZE, "NPIV Virtual (VPI %d)\n", vport->vpi);
473 @@ -2045,7 +2049,7 @@ lpfc_poll_show(struct device *dev, struc
474 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
475 struct lpfc_hba *phba = vport->phba;
477 - return snprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll);
478 + return scnprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll);
482 @@ -2149,7 +2153,7 @@ lpfc_fips_level_show(struct device *dev,
483 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
484 struct lpfc_hba *phba = vport->phba;
486 - return snprintf(buf, PAGE_SIZE, "%d\n", phba->fips_level);
487 + return scnprintf(buf, PAGE_SIZE, "%d\n", phba->fips_level);
491 @@ -2168,7 +2172,7 @@ lpfc_fips_rev_show(struct device *dev,
492 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
493 struct lpfc_hba *phba = vport->phba;
495 - return snprintf(buf, PAGE_SIZE, "%d\n", phba->fips_spec_rev);
496 + return scnprintf(buf, PAGE_SIZE, "%d\n", phba->fips_spec_rev);
500 @@ -2187,7 +2191,7 @@ lpfc_dss_show(struct device *dev, struct
501 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
502 struct lpfc_hba *phba = vport->phba;
504 - return snprintf(buf, PAGE_SIZE, "%s - %sOperational\n",
505 + return scnprintf(buf, PAGE_SIZE, "%s - %sOperational\n",
506 (phba->cfg_enable_dss) ? "Enabled" : "Disabled",
507 (phba->sli3_options & LPFC_SLI3_DSS_ENABLED) ?
509 @@ -2216,7 +2220,7 @@ lpfc_sriov_hw_max_virtfn_show(struct dev
510 uint16_t max_nr_virtfn;
512 max_nr_virtfn = lpfc_sli_sriov_nr_virtfn_get(phba);
513 - return snprintf(buf, PAGE_SIZE, "%d\n", max_nr_virtfn);
514 + return scnprintf(buf, PAGE_SIZE, "%d\n", max_nr_virtfn);
517 static inline bool lpfc_rangecheck(uint val, uint min, uint max)
518 @@ -2276,7 +2280,7 @@ lpfc_##attr##_show(struct device *dev, s
519 struct Scsi_Host *shost = class_to_shost(dev);\
520 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
521 struct lpfc_hba *phba = vport->phba;\
522 - return snprintf(buf, PAGE_SIZE, "%d\n",\
523 + return scnprintf(buf, PAGE_SIZE, "%d\n",\
527 @@ -2304,7 +2308,7 @@ lpfc_##attr##_show(struct device *dev, s
528 struct lpfc_hba *phba = vport->phba;\
530 val = phba->cfg_##attr;\
531 - return snprintf(buf, PAGE_SIZE, "%#x\n",\
532 + return scnprintf(buf, PAGE_SIZE, "%#x\n",\
536 @@ -2440,7 +2444,7 @@ lpfc_##attr##_show(struct device *dev, s
538 struct Scsi_Host *shost = class_to_shost(dev);\
539 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
540 - return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
541 + return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
545 @@ -2465,7 +2469,7 @@ lpfc_##attr##_show(struct device *dev, s
547 struct Scsi_Host *shost = class_to_shost(dev);\
548 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
549 - return snprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
550 + return scnprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
554 @@ -2736,7 +2740,7 @@ lpfc_soft_wwpn_show(struct device *dev,
555 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
556 struct lpfc_hba *phba = vport->phba;
558 - return snprintf(buf, PAGE_SIZE, "0x%llx\n",
559 + return scnprintf(buf, PAGE_SIZE, "0x%llx\n",
560 (unsigned long long)phba->cfg_soft_wwpn);
563 @@ -2833,7 +2837,7 @@ lpfc_soft_wwnn_show(struct device *dev,
565 struct Scsi_Host *shost = class_to_shost(dev);
566 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
567 - return snprintf(buf, PAGE_SIZE, "0x%llx\n",
568 + return scnprintf(buf, PAGE_SIZE, "0x%llx\n",
569 (unsigned long long)phba->cfg_soft_wwnn);
572 @@ -2899,7 +2903,7 @@ lpfc_oas_tgt_show(struct device *dev, st
573 struct Scsi_Host *shost = class_to_shost(dev);
574 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
576 - return snprintf(buf, PAGE_SIZE, "0x%llx\n",
577 + return scnprintf(buf, PAGE_SIZE, "0x%llx\n",
578 wwn_to_u64(phba->cfg_oas_tgt_wwpn));
581 @@ -2967,7 +2971,7 @@ lpfc_oas_priority_show(struct device *de
582 struct Scsi_Host *shost = class_to_shost(dev);
583 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
585 - return snprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority);
586 + return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority);
590 @@ -3030,7 +3034,7 @@ lpfc_oas_vpt_show(struct device *dev, st
591 struct Scsi_Host *shost = class_to_shost(dev);
592 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
594 - return snprintf(buf, PAGE_SIZE, "0x%llx\n",
595 + return scnprintf(buf, PAGE_SIZE, "0x%llx\n",
596 wwn_to_u64(phba->cfg_oas_vpt_wwpn));
599 @@ -3101,7 +3105,7 @@ lpfc_oas_lun_state_show(struct device *d
600 struct Scsi_Host *shost = class_to_shost(dev);
601 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
603 - return snprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_state);
604 + return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_state);
608 @@ -3165,7 +3169,7 @@ lpfc_oas_lun_status_show(struct device *
609 if (!(phba->cfg_oas_flags & OAS_LUN_VALID))
612 - return snprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_status);
613 + return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_status);
615 static DEVICE_ATTR(lpfc_xlane_lun_status, S_IRUGO,
616 lpfc_oas_lun_status_show, NULL);
617 @@ -3317,7 +3321,7 @@ lpfc_oas_lun_show(struct device *dev, st
618 if (oas_lun != NOT_OAS_ENABLED_LUN)
619 phba->cfg_oas_flags |= OAS_LUN_VALID;
621 - len += snprintf(buf + len, PAGE_SIZE-len, "0x%llx", oas_lun);
622 + len += scnprintf(buf + len, PAGE_SIZE-len, "0x%llx", oas_lun);
626 @@ -3451,7 +3455,7 @@ lpfc_iocb_hw_show(struct device *dev, st
627 struct Scsi_Host *shost = class_to_shost(dev);
628 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba;
630 - return snprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max);
631 + return scnprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max);
634 static DEVICE_ATTR(iocb_hw, S_IRUGO,
635 @@ -3463,7 +3467,7 @@ lpfc_txq_hw_show(struct device *dev, str
636 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba;
637 struct lpfc_sli_ring *pring = lpfc_phba_elsring(phba);
639 - return snprintf(buf, PAGE_SIZE, "%d\n",
640 + return scnprintf(buf, PAGE_SIZE, "%d\n",
641 pring ? pring->txq_max : 0);
644 @@ -3477,7 +3481,7 @@ lpfc_txcmplq_hw_show(struct device *dev,
645 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba;
646 struct lpfc_sli_ring *pring = lpfc_phba_elsring(phba);
648 - return snprintf(buf, PAGE_SIZE, "%d\n",
649 + return scnprintf(buf, PAGE_SIZE, "%d\n",
650 pring ? pring->txcmplq_max : 0);
653 @@ -3513,7 +3517,7 @@ lpfc_nodev_tmo_show(struct device *dev,
654 struct Scsi_Host *shost = class_to_shost(dev);
655 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
657 - return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo);
658 + return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo);
662 @@ -5016,19 +5020,19 @@ lpfc_fcp_cpu_map_show(struct device *dev
664 switch (phba->cfg_fcp_cpu_map) {
666 - len += snprintf(buf + len, PAGE_SIZE-len,
667 + len += scnprintf(buf + len, PAGE_SIZE-len,
668 "fcp_cpu_map: No mapping (%d)\n",
669 phba->cfg_fcp_cpu_map);
672 - len += snprintf(buf + len, PAGE_SIZE-len,
673 + len += scnprintf(buf + len, PAGE_SIZE-len,
674 "fcp_cpu_map: HBA centric mapping (%d): "
676 phba->cfg_fcp_cpu_map,
677 phba->sli4_hba.num_online_cpu);
680 - len += snprintf(buf + len, PAGE_SIZE-len,
681 + len += scnprintf(buf + len, PAGE_SIZE-len,
682 "fcp_cpu_map: Driver centric mapping (%d): "
684 phba->cfg_fcp_cpu_map,
685 @@ -5041,14 +5045,14 @@ lpfc_fcp_cpu_map_show(struct device *dev
687 /* margin should fit in this and the truncated message */
688 if (cpup->irq == LPFC_VECTOR_MAP_EMPTY)
689 - len += snprintf(buf + len, PAGE_SIZE-len,
690 + len += scnprintf(buf + len, PAGE_SIZE-len,
691 "CPU %02d io_chan %02d "
692 "physid %d coreid %d\n",
693 phba->sli4_hba.curr_disp_cpu,
694 cpup->channel_id, cpup->phys_id,
697 - len += snprintf(buf + len, PAGE_SIZE-len,
698 + len += scnprintf(buf + len, PAGE_SIZE-len,
699 "CPU %02d io_chan %02d "
700 "physid %d coreid %d IRQ %d\n",
701 phba->sli4_hba.curr_disp_cpu,
702 @@ -5061,7 +5065,7 @@ lpfc_fcp_cpu_map_show(struct device *dev
703 if (phba->sli4_hba.curr_disp_cpu <
704 phba->sli4_hba.num_present_cpu &&
705 (len >= (PAGE_SIZE - 64))) {
706 - len += snprintf(buf + len, PAGE_SIZE-len, "more...\n");
707 + len += scnprintf(buf + len, PAGE_SIZE-len, "more...\n");
711 @@ -5586,10 +5590,10 @@ lpfc_sg_seg_cnt_show(struct device *dev,
712 struct lpfc_hba *phba = vport->phba;
715 - len = snprintf(buf, PAGE_SIZE, "SGL sz: %d total SGEs: %d\n",
716 + len = scnprintf(buf, PAGE_SIZE, "SGL sz: %d total SGEs: %d\n",
717 phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt);
719 - len += snprintf(buf + len, PAGE_SIZE, "Cfg: %d SCSI: %d NVME: %d\n",
720 + len += scnprintf(buf + len, PAGE_SIZE, "Cfg: %d SCSI: %d NVME: %d\n",
721 phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt,
722 phba->cfg_nvme_seg_cnt);
724 @@ -6586,7 +6590,7 @@ lpfc_show_rport_##field (struct device *
726 struct fc_rport *rport = transport_class_to_rport(dev); \
727 struct lpfc_rport_data *rdata = rport->hostdata; \
728 - return snprintf(buf, sz, format_string, \
729 + return scnprintf(buf, sz, format_string, \
730 (rdata->target) ? cast rdata->target->field : 0); \
733 --- a/drivers/scsi/lpfc/lpfc_ct.c
734 +++ b/drivers/scsi/lpfc/lpfc_ct.c
735 @@ -1430,7 +1430,7 @@ lpfc_vport_symbolic_port_name(struct lpf
736 * Name object. NPIV is not in play so this integer
737 * value is sufficient and unique per FC-ID.
739 - n = snprintf(symbol, size, "%d", vport->phba->brd_no);
740 + n = scnprintf(symbol, size, "%d", vport->phba->brd_no);
744 @@ -1444,26 +1444,26 @@ lpfc_vport_symbolic_node_name(struct lpf
746 lpfc_decode_firmware_rev(vport->phba, fwrev, 0);
748 - n = snprintf(symbol, size, "Emulex %s", vport->phba->ModelName);
749 + n = scnprintf(symbol, size, "Emulex %s", vport->phba->ModelName);
753 - n += snprintf(symbol + n, size - n, " FV%s", fwrev);
754 + n += scnprintf(symbol + n, size - n, " FV%s", fwrev);
758 - n += snprintf(symbol + n, size - n, " DV%s.",
759 + n += scnprintf(symbol + n, size - n, " DV%s.",
760 lpfc_release_version);
764 - n += snprintf(symbol + n, size - n, " HN:%s.",
765 + n += scnprintf(symbol + n, size - n, " HN:%s.",
766 init_utsname()->nodename);
770 /* Note :- OS name is "Linux" */
771 - n += snprintf(symbol + n, size - n, " OS:%s\n",
772 + n += scnprintf(symbol + n, size - n, " OS:%s\n",
773 init_utsname()->sysname);
776 --- a/drivers/scsi/lpfc/lpfc_debugfs.c
777 +++ b/drivers/scsi/lpfc/lpfc_debugfs.c
778 @@ -170,7 +170,7 @@ lpfc_debugfs_disc_trc_data(struct lpfc_v
780 LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n",
781 dtp->seq_cnt, ms, dtp->fmt);
782 - len += snprintf(buf+len, size-len, buffer,
783 + len += scnprintf(buf+len, size-len, buffer,
784 dtp->data1, dtp->data2, dtp->data3);
786 for (i = 0; i < index; i++) {
787 @@ -181,7 +181,7 @@ lpfc_debugfs_disc_trc_data(struct lpfc_v
789 LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n",
790 dtp->seq_cnt, ms, dtp->fmt);
791 - len += snprintf(buf+len, size-len, buffer,
792 + len += scnprintf(buf+len, size-len, buffer,
793 dtp->data1, dtp->data2, dtp->data3);
796 @@ -236,7 +236,7 @@ lpfc_debugfs_slow_ring_trc_data(struct l
798 LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n",
799 dtp->seq_cnt, ms, dtp->fmt);
800 - len += snprintf(buf+len, size-len, buffer,
801 + len += scnprintf(buf+len, size-len, buffer,
802 dtp->data1, dtp->data2, dtp->data3);
804 for (i = 0; i < index; i++) {
805 @@ -247,7 +247,7 @@ lpfc_debugfs_slow_ring_trc_data(struct l
807 LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n",
808 dtp->seq_cnt, ms, dtp->fmt);
809 - len += snprintf(buf+len, size-len, buffer,
810 + len += scnprintf(buf+len, size-len, buffer,
811 dtp->data1, dtp->data2, dtp->data3);
814 @@ -307,7 +307,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hb
816 i = lpfc_debugfs_last_hbq;
818 - len += snprintf(buf+len, size-len, "HBQ %d Info\n", i);
819 + len += scnprintf(buf+len, size-len, "HBQ %d Info\n", i);
821 hbqs = &phba->hbqs[i];
823 @@ -315,21 +315,21 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hb
826 hip = lpfc_hbq_defs[i];
827 - len += snprintf(buf+len, size-len,
828 + len += scnprintf(buf+len, size-len,
829 "idx:%d prof:%d rn:%d bufcnt:%d icnt:%d acnt:%d posted %d\n",
830 hip->hbq_index, hip->profile, hip->rn,
831 hip->buffer_count, hip->init_count, hip->add_count, posted);
833 raw_index = phba->hbq_get[i];
834 getidx = le32_to_cpu(raw_index);
835 - len += snprintf(buf+len, size-len,
836 + len += scnprintf(buf+len, size-len,
837 "entries:%d bufcnt:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n",
838 hbqs->entry_count, hbqs->buffer_count, hbqs->hbqPutIdx,
839 hbqs->next_hbqPutIdx, hbqs->local_hbqGetIdx, getidx);
841 hbqe = (struct lpfc_hbq_entry *) phba->hbqs[i].hbq_virt;
842 for (j=0; j<hbqs->entry_count; j++) {
843 - len += snprintf(buf+len, size-len,
844 + len += scnprintf(buf+len, size-len,
845 "%03d: %08x %04x %05x ", j,
846 le32_to_cpu(hbqe->bde.addrLow),
847 le32_to_cpu(hbqe->bde.tus.w),
848 @@ -341,14 +341,16 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hb
849 low = hbqs->hbqPutIdx - posted;
851 if ((j >= hbqs->hbqPutIdx) || (j < low)) {
852 - len += snprintf(buf+len, size-len, "Unused\n");
853 + len += scnprintf(buf + len, size - len,
859 if ((j >= hbqs->hbqPutIdx) &&
860 (j < (hbqs->entry_count+low))) {
861 - len += snprintf(buf+len, size-len, "Unused\n");
862 + len += scnprintf(buf + len, size - len,
867 @@ -358,7 +360,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hb
868 hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
869 phys = ((uint64_t)hbq_buf->dbuf.phys & 0xffffffff);
870 if (phys == le32_to_cpu(hbqe->bde.addrLow)) {
871 - len += snprintf(buf+len, size-len,
872 + len += scnprintf(buf+len, size-len,
873 "Buf%d: %p %06x\n", i,
874 hbq_buf->dbuf.virt, hbq_buf->tag);
876 @@ -367,7 +369,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hb
880 - len += snprintf(buf+len, size-len, "No DMAinfo?\n");
881 + len += scnprintf(buf+len, size-len, "No DMAinfo?\n");
885 @@ -413,7 +415,7 @@ lpfc_debugfs_dumpHBASlim_data(struct lpf
887 spin_lock_irq(&phba->hbalock);
889 - len += snprintf(buf+len, size-len, "HBA SLIM\n");
890 + len += scnprintf(buf+len, size-len, "HBA SLIM\n");
891 lpfc_memcpy_from_slim(buffer,
892 phba->MBslimaddr + lpfc_debugfs_last_hba_slim_off, 1024);
894 @@ -427,7 +429,7 @@ lpfc_debugfs_dumpHBASlim_data(struct lpf
898 - len += snprintf(buf+len, size-len,
899 + len += scnprintf(buf+len, size-len,
900 "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
901 off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4),
902 *(ptr+5), *(ptr+6), *(ptr+7));
903 @@ -471,11 +473,11 @@ lpfc_debugfs_dumpHostSlim_data(struct lp
905 spin_lock_irq(&phba->hbalock);
907 - len += snprintf(buf+len, size-len, "SLIM Mailbox\n");
908 + len += scnprintf(buf+len, size-len, "SLIM Mailbox\n");
909 ptr = (uint32_t *)phba->slim2p.virt;
910 i = sizeof(MAILBOX_t);
912 - len += snprintf(buf+len, size-len,
913 + len += scnprintf(buf+len, size-len,
914 "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
915 off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4),
916 *(ptr+5), *(ptr+6), *(ptr+7));
917 @@ -484,11 +486,11 @@ lpfc_debugfs_dumpHostSlim_data(struct lp
918 off += (8 * sizeof(uint32_t));
921 - len += snprintf(buf+len, size-len, "SLIM PCB\n");
922 + len += scnprintf(buf+len, size-len, "SLIM PCB\n");
923 ptr = (uint32_t *)phba->pcb;
926 - len += snprintf(buf+len, size-len,
927 + len += scnprintf(buf+len, size-len,
928 "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
929 off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4),
930 *(ptr+5), *(ptr+6), *(ptr+7));
931 @@ -501,7 +503,7 @@ lpfc_debugfs_dumpHostSlim_data(struct lp
932 for (i = 0; i < 4; i++) {
933 pgpp = &phba->port_gp[i];
934 pring = &psli->sli3_ring[i];
935 - len += snprintf(buf+len, size-len,
936 + len += scnprintf(buf+len, size-len,
937 "Ring %d: CMD GetInx:%d "
940 @@ -518,7 +520,7 @@ lpfc_debugfs_dumpHostSlim_data(struct lp
941 word1 = readl(phba->CAregaddr);
942 word2 = readl(phba->HSregaddr);
943 word3 = readl(phba->HCregaddr);
944 - len += snprintf(buf+len, size-len, "HA:%08x CA:%08x HS:%08x "
945 + len += scnprintf(buf+len, size-len, "HA:%08x CA:%08x HS:%08x "
946 "HC:%08x\n", word0, word1, word2, word3);
948 spin_unlock_irq(&phba->hbalock);
949 @@ -556,12 +558,12 @@ lpfc_debugfs_nodelist_data(struct lpfc_v
950 cnt = (LPFC_NODELIST_SIZE / LPFC_NODELIST_ENTRY_SIZE);
953 - len += snprintf(buf+len, size-len, "\nFCP Nodelist Entries ...\n");
954 + len += scnprintf(buf+len, size-len, "\nFCP Nodelist Entries ...\n");
955 spin_lock_irq(shost->host_lock);
956 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
959 - len += snprintf(buf+len, size-len,
960 + len += scnprintf(buf+len, size-len,
961 "Missing Nodelist Entries\n");
964 @@ -599,63 +601,63 @@ lpfc_debugfs_nodelist_data(struct lpfc_v
968 - len += snprintf(buf+len, size-len, "%s DID:x%06x ",
969 + len += scnprintf(buf+len, size-len, "%s DID:x%06x ",
970 statep, ndlp->nlp_DID);
971 - len += snprintf(buf+len, size-len,
972 + len += scnprintf(buf+len, size-len,
974 wwn_to_u64(ndlp->nlp_portname.u.wwn));
975 - len += snprintf(buf+len, size-len,
976 + len += scnprintf(buf+len, size-len,
978 wwn_to_u64(ndlp->nlp_nodename.u.wwn));
979 if (ndlp->nlp_flag & NLP_RPI_REGISTERED)
980 - len += snprintf(buf+len, size-len, "RPI:%03d ",
981 + len += scnprintf(buf+len, size-len, "RPI:%03d ",
984 - len += snprintf(buf+len, size-len, "RPI:none ");
985 - len += snprintf(buf+len, size-len, "flag:x%08x ",
986 + len += scnprintf(buf+len, size-len, "RPI:none ");
987 + len += scnprintf(buf+len, size-len, "flag:x%08x ",
990 - len += snprintf(buf+len, size-len, "UNKNOWN_TYPE ");
991 + len += scnprintf(buf+len, size-len, "UNKNOWN_TYPE ");
992 if (ndlp->nlp_type & NLP_FC_NODE)
993 - len += snprintf(buf+len, size-len, "FC_NODE ");
994 + len += scnprintf(buf+len, size-len, "FC_NODE ");
995 if (ndlp->nlp_type & NLP_FABRIC) {
996 - len += snprintf(buf+len, size-len, "FABRIC ");
997 + len += scnprintf(buf+len, size-len, "FABRIC ");
1000 if (ndlp->nlp_type & NLP_FCP_TARGET)
1001 - len += snprintf(buf+len, size-len, "FCP_TGT sid:%d ",
1002 + len += scnprintf(buf+len, size-len, "FCP_TGT sid:%d ",
1004 if (ndlp->nlp_type & NLP_FCP_INITIATOR)
1005 - len += snprintf(buf+len, size-len, "FCP_INITIATOR ");
1006 + len += scnprintf(buf+len, size-len, "FCP_INITIATOR ");
1007 if (ndlp->nlp_type & NLP_NVME_TARGET)
1008 - len += snprintf(buf + len,
1009 + len += scnprintf(buf + len,
1010 size - len, "NVME_TGT sid:%d ",
1012 if (ndlp->nlp_type & NLP_NVME_INITIATOR)
1013 - len += snprintf(buf + len,
1014 + len += scnprintf(buf + len,
1015 size - len, "NVME_INITIATOR ");
1016 - len += snprintf(buf+len, size-len, "usgmap:%x ",
1017 + len += scnprintf(buf+len, size-len, "usgmap:%x ",
1019 - len += snprintf(buf+len, size-len, "refcnt:%x",
1020 + len += scnprintf(buf+len, size-len, "refcnt:%x",
1021 kref_read(&ndlp->kref));
1023 i = atomic_read(&ndlp->cmd_pending);
1024 - len += snprintf(buf + len, size - len,
1025 + len += scnprintf(buf + len, size - len,
1026 " OutIO:x%x Qdepth x%x",
1027 i, ndlp->cmd_qdepth);
1030 - len += snprintf(buf + len, size - len, "defer:%x ",
1031 + len += scnprintf(buf + len, size - len, "defer:%x ",
1032 ndlp->nlp_defer_did);
1033 - len += snprintf(buf+len, size-len, "\n");
1034 + len += scnprintf(buf+len, size-len, "\n");
1036 spin_unlock_irq(shost->host_lock);
1038 - len += snprintf(buf + len, size - len,
1039 + len += scnprintf(buf + len, size - len,
1040 "\nOutstanding IO x%x\n", outio);
1042 if (phba->nvmet_support && phba->targetport && (vport == phba->pport)) {
1043 - len += snprintf(buf + len, size - len,
1044 + len += scnprintf(buf + len, size - len,
1045 "\nNVME Targetport Entry ...\n");
1047 /* Port state is only one of two values for now. */
1048 @@ -663,18 +665,18 @@ lpfc_debugfs_nodelist_data(struct lpfc_v
1049 statep = "REGISTERED";
1052 - len += snprintf(buf + len, size - len,
1053 + len += scnprintf(buf + len, size - len,
1054 "TGT WWNN x%llx WWPN x%llx State %s\n",
1055 wwn_to_u64(vport->fc_nodename.u.wwn),
1056 wwn_to_u64(vport->fc_portname.u.wwn),
1058 - len += snprintf(buf + len, size - len,
1059 + len += scnprintf(buf + len, size - len,
1060 " Targetport DID x%06x\n",
1061 phba->targetport->port_id);
1065 - len += snprintf(buf + len, size - len,
1066 + len += scnprintf(buf + len, size - len,
1067 "\nNVME Lport/Rport Entries ...\n");
1069 localport = vport->localport;
1070 @@ -689,11 +691,11 @@ lpfc_debugfs_nodelist_data(struct lpfc_v
1072 statep = "UNKNOWN ";
1074 - len += snprintf(buf + len, size - len,
1075 + len += scnprintf(buf + len, size - len,
1076 "Lport DID x%06x PortState %s\n",
1077 localport->port_id, statep);
1079 - len += snprintf(buf + len, size - len, "\tRport List:\n");
1080 + len += scnprintf(buf + len, size - len, "\tRport List:\n");
1081 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
1082 /* local short-hand pointer. */
1083 spin_lock(&phba->hbalock);
1084 @@ -720,32 +722,32 @@ lpfc_debugfs_nodelist_data(struct lpfc_v
1087 /* Tab in to show lport ownership. */
1088 - len += snprintf(buf + len, size - len,
1089 + len += scnprintf(buf + len, size - len,
1090 "\t%s Port ID:x%06x ",
1091 statep, nrport->port_id);
1092 - len += snprintf(buf + len, size - len, "WWPN x%llx ",
1093 + len += scnprintf(buf + len, size - len, "WWPN x%llx ",
1095 - len += snprintf(buf + len, size - len, "WWNN x%llx ",
1096 + len += scnprintf(buf + len, size - len, "WWNN x%llx ",
1099 /* An NVME rport can have multiple roles. */
1100 if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR)
1101 - len += snprintf(buf + len, size - len,
1102 + len += scnprintf(buf + len, size - len,
1104 if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET)
1105 - len += snprintf(buf + len, size - len,
1106 + len += scnprintf(buf + len, size - len,
1108 if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY)
1109 - len += snprintf(buf + len, size - len,
1110 + len += scnprintf(buf + len, size - len,
1112 if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR |
1113 FC_PORT_ROLE_NVME_TARGET |
1114 FC_PORT_ROLE_NVME_DISCOVERY))
1115 - len += snprintf(buf + len, size - len,
1116 + len += scnprintf(buf + len, size - len,
1119 /* Terminate the string. */
1120 - len += snprintf(buf + len, size - len, "\n");
1121 + len += scnprintf(buf + len, size - len, "\n");
1124 spin_unlock_irq(shost->host_lock);
1125 @@ -784,35 +786,35 @@ lpfc_debugfs_nvmestat_data(struct lpfc_v
1126 if (!phba->targetport)
1128 tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
1129 - len += snprintf(buf + len, size - len,
1130 + len += scnprintf(buf + len, size - len,
1131 "\nNVME Targetport Statistics\n");
1133 - len += snprintf(buf + len, size - len,
1134 + len += scnprintf(buf + len, size - len,
1135 "LS: Rcv %08x Drop %08x Abort %08x\n",
1136 atomic_read(&tgtp->rcv_ls_req_in),
1137 atomic_read(&tgtp->rcv_ls_req_drop),
1138 atomic_read(&tgtp->xmt_ls_abort));
1139 if (atomic_read(&tgtp->rcv_ls_req_in) !=
1140 atomic_read(&tgtp->rcv_ls_req_out)) {
1141 - len += snprintf(buf + len, size - len,
1142 + len += scnprintf(buf + len, size - len,
1143 "Rcv LS: in %08x != out %08x\n",
1144 atomic_read(&tgtp->rcv_ls_req_in),
1145 atomic_read(&tgtp->rcv_ls_req_out));
1148 - len += snprintf(buf + len, size - len,
1149 + len += scnprintf(buf + len, size - len,
1150 "LS: Xmt %08x Drop %08x Cmpl %08x\n",
1151 atomic_read(&tgtp->xmt_ls_rsp),
1152 atomic_read(&tgtp->xmt_ls_drop),
1153 atomic_read(&tgtp->xmt_ls_rsp_cmpl));
1155 - len += snprintf(buf + len, size - len,
1156 + len += scnprintf(buf + len, size - len,
1157 "LS: RSP Abort %08x xb %08x Err %08x\n",
1158 atomic_read(&tgtp->xmt_ls_rsp_aborted),
1159 atomic_read(&tgtp->xmt_ls_rsp_xb_set),
1160 atomic_read(&tgtp->xmt_ls_rsp_error));
1162 - len += snprintf(buf + len, size - len,
1163 + len += scnprintf(buf + len, size - len,
1164 "FCP: Rcv %08x Defer %08x Release %08x "
1166 atomic_read(&tgtp->rcv_fcp_cmd_in),
1167 @@ -822,13 +824,13 @@ lpfc_debugfs_nvmestat_data(struct lpfc_v
1169 if (atomic_read(&tgtp->rcv_fcp_cmd_in) !=
1170 atomic_read(&tgtp->rcv_fcp_cmd_out)) {
1171 - len += snprintf(buf + len, size - len,
1172 + len += scnprintf(buf + len, size - len,
1173 "Rcv FCP: in %08x != out %08x\n",
1174 atomic_read(&tgtp->rcv_fcp_cmd_in),
1175 atomic_read(&tgtp->rcv_fcp_cmd_out));
1178 - len += snprintf(buf + len, size - len,
1179 + len += scnprintf(buf + len, size - len,
1180 "FCP Rsp: read %08x readrsp %08x "
1181 "write %08x rsp %08x\n",
1182 atomic_read(&tgtp->xmt_fcp_read),
1183 @@ -836,31 +838,31 @@ lpfc_debugfs_nvmestat_data(struct lpfc_v
1184 atomic_read(&tgtp->xmt_fcp_write),
1185 atomic_read(&tgtp->xmt_fcp_rsp));
1187 - len += snprintf(buf + len, size - len,
1188 + len += scnprintf(buf + len, size - len,
1189 "FCP Rsp Cmpl: %08x err %08x drop %08x\n",
1190 atomic_read(&tgtp->xmt_fcp_rsp_cmpl),
1191 atomic_read(&tgtp->xmt_fcp_rsp_error),
1192 atomic_read(&tgtp->xmt_fcp_rsp_drop));
1194 - len += snprintf(buf + len, size - len,
1195 + len += scnprintf(buf + len, size - len,
1196 "FCP Rsp Abort: %08x xb %08x xricqe %08x\n",
1197 atomic_read(&tgtp->xmt_fcp_rsp_aborted),
1198 atomic_read(&tgtp->xmt_fcp_rsp_xb_set),
1199 atomic_read(&tgtp->xmt_fcp_xri_abort_cqe));
1201 - len += snprintf(buf + len, size - len,
1202 + len += scnprintf(buf + len, size - len,
1203 "ABORT: Xmt %08x Cmpl %08x\n",
1204 atomic_read(&tgtp->xmt_fcp_abort),
1205 atomic_read(&tgtp->xmt_fcp_abort_cmpl));
1207 - len += snprintf(buf + len, size - len,
1208 + len += scnprintf(buf + len, size - len,
1209 "ABORT: Sol %08x Usol %08x Err %08x Cmpl %08x",
1210 atomic_read(&tgtp->xmt_abort_sol),
1211 atomic_read(&tgtp->xmt_abort_unsol),
1212 atomic_read(&tgtp->xmt_abort_rsp),
1213 atomic_read(&tgtp->xmt_abort_rsp_error));
1215 - len += snprintf(buf + len, size - len, "\n");
1216 + len += scnprintf(buf + len, size - len, "\n");
1219 spin_lock(&phba->sli4_hba.abts_nvme_buf_list_lock);
1220 @@ -871,7 +873,7 @@ lpfc_debugfs_nvmestat_data(struct lpfc_v
1222 spin_unlock(&phba->sli4_hba.abts_nvme_buf_list_lock);
1224 - len += snprintf(buf + len, size - len,
1225 + len += scnprintf(buf + len, size - len,
1226 "ABORT: %d ctx entries\n", cnt);
1227 spin_lock(&phba->sli4_hba.abts_nvme_buf_list_lock);
1228 list_for_each_entry_safe(ctxp, next_ctxp,
1229 @@ -879,7 +881,7 @@ lpfc_debugfs_nvmestat_data(struct lpfc_v
1231 if (len >= (size - LPFC_DEBUG_OUT_LINE_SZ))
1233 - len += snprintf(buf + len, size - len,
1234 + len += scnprintf(buf + len, size - len,
1235 "Entry: oxid %x state %x "
1237 ctxp->oxid, ctxp->state,
1238 @@ -893,7 +895,7 @@ lpfc_debugfs_nvmestat_data(struct lpfc_v
1239 tot += atomic_read(&tgtp->xmt_fcp_release);
1240 tot = atomic_read(&tgtp->rcv_fcp_cmd_in) - tot;
1242 - len += snprintf(buf + len, size - len,
1243 + len += scnprintf(buf + len, size - len,
1244 "IO_CTX: %08x WAIT: cur %08x tot %08x\n"
1245 "CTX Outstanding %08llx\n",
1246 phba->sli4_hba.nvmet_xri_cnt,
1247 @@ -911,10 +913,10 @@ lpfc_debugfs_nvmestat_data(struct lpfc_v
1251 - len += snprintf(buf + len, size - len,
1252 + len += scnprintf(buf + len, size - len,
1253 "\nNVME Lport Statistics\n");
1255 - len += snprintf(buf + len, size - len,
1256 + len += scnprintf(buf + len, size - len,
1257 "LS: Xmt %016x Cmpl %016x\n",
1258 atomic_read(&lport->fc4NvmeLsRequests),
1259 atomic_read(&lport->fc4NvmeLsCmpls));
1260 @@ -938,20 +940,20 @@ lpfc_debugfs_nvmestat_data(struct lpfc_v
1264 - len += snprintf(buf + len, PAGE_SIZE - len,
1265 + len += scnprintf(buf + len, PAGE_SIZE - len,
1266 "FCP (%d): Rd %016llx Wr %016llx "
1268 i, data1, data2, data3);
1269 - len += snprintf(buf + len, PAGE_SIZE - len,
1270 + len += scnprintf(buf + len, PAGE_SIZE - len,
1271 "Cmpl %016llx OutIO %016llx\n",
1272 tot, ((data1 + data2 + data3) - tot));
1274 - len += snprintf(buf + len, PAGE_SIZE - len,
1275 + len += scnprintf(buf + len, PAGE_SIZE - len,
1276 "Total FCP Cmpl %016llx Issue %016llx "
1278 totin, totout, totout - totin);
1280 - len += snprintf(buf + len, size - len,
1281 + len += scnprintf(buf + len, size - len,
1282 "LS Xmt Err: Abrt %08x Err %08x "
1283 "Cmpl Err: xb %08x Err %08x\n",
1284 atomic_read(&lport->xmt_ls_abort),
1285 @@ -959,7 +961,7 @@ lpfc_debugfs_nvmestat_data(struct lpfc_v
1286 atomic_read(&lport->cmpl_ls_xb),
1287 atomic_read(&lport->cmpl_ls_err));
1289 - len += snprintf(buf + len, size - len,
1290 + len += scnprintf(buf + len, size - len,
1291 "FCP Xmt Err: noxri %06x nondlp %06x "
1292 "qdepth %06x wqerr %06x err %06x Abrt %06x\n",
1293 atomic_read(&lport->xmt_fcp_noxri),
1294 @@ -969,7 +971,7 @@ lpfc_debugfs_nvmestat_data(struct lpfc_v
1295 atomic_read(&lport->xmt_fcp_err),
1296 atomic_read(&lport->xmt_fcp_abort));
1298 - len += snprintf(buf + len, size - len,
1299 + len += scnprintf(buf + len, size - len,
1300 "FCP Cmpl Err: xb %08x Err %08x\n",
1301 atomic_read(&lport->cmpl_fcp_xb),
1302 atomic_read(&lport->cmpl_fcp_err));
1303 @@ -1001,58 +1003,58 @@ lpfc_debugfs_nvmektime_data(struct lpfc_
1305 if (phba->nvmet_support == 0) {
1306 /* NVME Initiator */
1307 - len += snprintf(buf + len, PAGE_SIZE - len,
1308 + len += scnprintf(buf + len, PAGE_SIZE - len,
1309 "ktime %s: Total Samples: %lld\n",
1310 (phba->ktime_on ? "Enabled" : "Disabled"),
1311 phba->ktime_data_samples);
1312 if (phba->ktime_data_samples == 0)
1317 buf + len, PAGE_SIZE - len,
1318 "Segment 1: Last NVME Cmd cmpl "
1319 "done -to- Start of next NVME cnd (in driver)\n");
1322 buf + len, PAGE_SIZE - len,
1323 "avg:%08lld min:%08lld max %08lld\n",
1324 div_u64(phba->ktime_seg1_total,
1325 phba->ktime_data_samples),
1326 phba->ktime_seg1_min,
1327 phba->ktime_seg1_max);
1330 buf + len, PAGE_SIZE - len,
1331 "Segment 2: Driver start of NVME cmd "
1332 "-to- Firmware WQ doorbell\n");
1335 buf + len, PAGE_SIZE - len,
1336 "avg:%08lld min:%08lld max %08lld\n",
1337 div_u64(phba->ktime_seg2_total,
1338 phba->ktime_data_samples),
1339 phba->ktime_seg2_min,
1340 phba->ktime_seg2_max);
1343 buf + len, PAGE_SIZE - len,
1344 "Segment 3: Firmware WQ doorbell -to- "
1345 "MSI-X ISR cmpl\n");
1348 buf + len, PAGE_SIZE - len,
1349 "avg:%08lld min:%08lld max %08lld\n",
1350 div_u64(phba->ktime_seg3_total,
1351 phba->ktime_data_samples),
1352 phba->ktime_seg3_min,
1353 phba->ktime_seg3_max);
1356 buf + len, PAGE_SIZE - len,
1357 "Segment 4: MSI-X ISR cmpl -to- "
1358 "NVME cmpl done\n");
1361 buf + len, PAGE_SIZE - len,
1362 "avg:%08lld min:%08lld max %08lld\n",
1363 div_u64(phba->ktime_seg4_total,
1364 phba->ktime_data_samples),
1365 phba->ktime_seg4_min,
1366 phba->ktime_seg4_max);
1369 buf + len, PAGE_SIZE - len,
1370 "Total IO avg time: %08lld\n",
1371 div_u64(phba->ktime_seg1_total +
1372 @@ -1064,7 +1066,7 @@ lpfc_debugfs_nvmektime_data(struct lpfc_
1376 - len += snprintf(buf + len, PAGE_SIZE-len,
1377 + len += scnprintf(buf + len, PAGE_SIZE-len,
1378 "ktime %s: Total Samples: %lld %lld\n",
1379 (phba->ktime_on ? "Enabled" : "Disabled"),
1380 phba->ktime_data_samples,
1381 @@ -1072,46 +1074,46 @@ lpfc_debugfs_nvmektime_data(struct lpfc_
1382 if (phba->ktime_data_samples == 0)
1385 - len += snprintf(buf + len, PAGE_SIZE-len,
1386 + len += scnprintf(buf + len, PAGE_SIZE-len,
1387 "Segment 1: MSI-X ISR Rcv cmd -to- "
1388 "cmd pass to NVME Layer\n");
1389 - len += snprintf(buf + len, PAGE_SIZE-len,
1390 + len += scnprintf(buf + len, PAGE_SIZE-len,
1391 "avg:%08lld min:%08lld max %08lld\n",
1392 div_u64(phba->ktime_seg1_total,
1393 phba->ktime_data_samples),
1394 phba->ktime_seg1_min,
1395 phba->ktime_seg1_max);
1396 - len += snprintf(buf + len, PAGE_SIZE-len,
1397 + len += scnprintf(buf + len, PAGE_SIZE-len,
1398 "Segment 2: cmd pass to NVME Layer- "
1399 "-to- Driver rcv cmd OP (action)\n");
1400 - len += snprintf(buf + len, PAGE_SIZE-len,
1401 + len += scnprintf(buf + len, PAGE_SIZE-len,
1402 "avg:%08lld min:%08lld max %08lld\n",
1403 div_u64(phba->ktime_seg2_total,
1404 phba->ktime_data_samples),
1405 phba->ktime_seg2_min,
1406 phba->ktime_seg2_max);
1407 - len += snprintf(buf + len, PAGE_SIZE-len,
1408 + len += scnprintf(buf + len, PAGE_SIZE-len,
1409 "Segment 3: Driver rcv cmd OP -to- "
1410 "Firmware WQ doorbell: cmd\n");
1411 - len += snprintf(buf + len, PAGE_SIZE-len,
1412 + len += scnprintf(buf + len, PAGE_SIZE-len,
1413 "avg:%08lld min:%08lld max %08lld\n",
1414 div_u64(phba->ktime_seg3_total,
1415 phba->ktime_data_samples),
1416 phba->ktime_seg3_min,
1417 phba->ktime_seg3_max);
1418 - len += snprintf(buf + len, PAGE_SIZE-len,
1419 + len += scnprintf(buf + len, PAGE_SIZE-len,
1420 "Segment 4: Firmware WQ doorbell: cmd "
1421 "-to- MSI-X ISR for cmd cmpl\n");
1422 - len += snprintf(buf + len, PAGE_SIZE-len,
1423 + len += scnprintf(buf + len, PAGE_SIZE-len,
1424 "avg:%08lld min:%08lld max %08lld\n",
1425 div_u64(phba->ktime_seg4_total,
1426 phba->ktime_data_samples),
1427 phba->ktime_seg4_min,
1428 phba->ktime_seg4_max);
1429 - len += snprintf(buf + len, PAGE_SIZE-len,
1430 + len += scnprintf(buf + len, PAGE_SIZE-len,
1431 "Segment 5: MSI-X ISR for cmd cmpl "
1432 "-to- NVME layer passed cmd done\n");
1433 - len += snprintf(buf + len, PAGE_SIZE-len,
1434 + len += scnprintf(buf + len, PAGE_SIZE-len,
1435 "avg:%08lld min:%08lld max %08lld\n",
1436 div_u64(phba->ktime_seg5_total,
1437 phba->ktime_data_samples),
1438 @@ -1119,10 +1121,10 @@ lpfc_debugfs_nvmektime_data(struct lpfc_
1439 phba->ktime_seg5_max);
1441 if (phba->ktime_status_samples == 0) {
1442 - len += snprintf(buf + len, PAGE_SIZE-len,
1443 + len += scnprintf(buf + len, PAGE_SIZE-len,
1444 "Total: cmd received by MSI-X ISR "
1445 "-to- cmd completed on wire\n");
1446 - len += snprintf(buf + len, PAGE_SIZE-len,
1447 + len += scnprintf(buf + len, PAGE_SIZE-len,
1448 "avg:%08lld min:%08lld "
1450 div_u64(phba->ktime_seg10_total,
1451 @@ -1132,46 +1134,46 @@ lpfc_debugfs_nvmektime_data(struct lpfc_
1455 - len += snprintf(buf + len, PAGE_SIZE-len,
1456 + len += scnprintf(buf + len, PAGE_SIZE-len,
1457 "Segment 6: NVME layer passed cmd done "
1458 "-to- Driver rcv rsp status OP\n");
1459 - len += snprintf(buf + len, PAGE_SIZE-len,
1460 + len += scnprintf(buf + len, PAGE_SIZE-len,
1461 "avg:%08lld min:%08lld max %08lld\n",
1462 div_u64(phba->ktime_seg6_total,
1463 phba->ktime_status_samples),
1464 phba->ktime_seg6_min,
1465 phba->ktime_seg6_max);
1466 - len += snprintf(buf + len, PAGE_SIZE-len,
1467 + len += scnprintf(buf + len, PAGE_SIZE-len,
1468 "Segment 7: Driver rcv rsp status OP "
1469 "-to- Firmware WQ doorbell: status\n");
1470 - len += snprintf(buf + len, PAGE_SIZE-len,
1471 + len += scnprintf(buf + len, PAGE_SIZE-len,
1472 "avg:%08lld min:%08lld max %08lld\n",
1473 div_u64(phba->ktime_seg7_total,
1474 phba->ktime_status_samples),
1475 phba->ktime_seg7_min,
1476 phba->ktime_seg7_max);
1477 - len += snprintf(buf + len, PAGE_SIZE-len,
1478 + len += scnprintf(buf + len, PAGE_SIZE-len,
1479 "Segment 8: Firmware WQ doorbell: status"
1480 " -to- MSI-X ISR for status cmpl\n");
1481 - len += snprintf(buf + len, PAGE_SIZE-len,
1482 + len += scnprintf(buf + len, PAGE_SIZE-len,
1483 "avg:%08lld min:%08lld max %08lld\n",
1484 div_u64(phba->ktime_seg8_total,
1485 phba->ktime_status_samples),
1486 phba->ktime_seg8_min,
1487 phba->ktime_seg8_max);
1488 - len += snprintf(buf + len, PAGE_SIZE-len,
1489 + len += scnprintf(buf + len, PAGE_SIZE-len,
1490 "Segment 9: MSI-X ISR for status cmpl "
1491 "-to- NVME layer passed status done\n");
1492 - len += snprintf(buf + len, PAGE_SIZE-len,
1493 + len += scnprintf(buf + len, PAGE_SIZE-len,
1494 "avg:%08lld min:%08lld max %08lld\n",
1495 div_u64(phba->ktime_seg9_total,
1496 phba->ktime_status_samples),
1497 phba->ktime_seg9_min,
1498 phba->ktime_seg9_max);
1499 - len += snprintf(buf + len, PAGE_SIZE-len,
1500 + len += scnprintf(buf + len, PAGE_SIZE-len,
1501 "Total: cmd received by MSI-X ISR -to- "
1502 "cmd completed on wire\n");
1503 - len += snprintf(buf + len, PAGE_SIZE-len,
1504 + len += scnprintf(buf + len, PAGE_SIZE-len,
1505 "avg:%08lld min:%08lld max %08lld\n",
1506 div_u64(phba->ktime_seg10_total,
1507 phba->ktime_status_samples),
1508 @@ -1206,7 +1208,7 @@ lpfc_debugfs_nvmeio_trc_data(struct lpfc
1509 (phba->nvmeio_trc_size - 1);
1510 skip = phba->nvmeio_trc_output_idx;
1512 - len += snprintf(buf + len, size - len,
1513 + len += scnprintf(buf + len, size - len,
1514 "%s IO Trace %s: next_idx %d skip %d size %d\n",
1515 (phba->nvmet_support ? "NVME" : "NVMET"),
1516 (state ? "Enabled" : "Disabled"),
1517 @@ -1228,18 +1230,18 @@ lpfc_debugfs_nvmeio_trc_data(struct lpfc
1521 - len += snprintf(buf + len, size - len, dtp->fmt,
1522 + len += scnprintf(buf + len, size - len, dtp->fmt,
1523 dtp->data1, dtp->data2, dtp->data3);
1525 if (phba->nvmeio_trc_output_idx >= phba->nvmeio_trc_size) {
1526 phba->nvmeio_trc_output_idx = 0;
1527 - len += snprintf(buf + len, size - len,
1528 + len += scnprintf(buf + len, size - len,
1529 "Trace Complete\n");
1533 if (len >= (size - LPFC_DEBUG_OUT_LINE_SZ)) {
1534 - len += snprintf(buf + len, size - len,
1535 + len += scnprintf(buf + len, size - len,
1536 "Trace Continue (%d of %d)\n",
1537 phba->nvmeio_trc_output_idx,
1538 phba->nvmeio_trc_size);
1539 @@ -1257,18 +1259,18 @@ lpfc_debugfs_nvmeio_trc_data(struct lpfc
1543 - len += snprintf(buf + len, size - len, dtp->fmt,
1544 + len += scnprintf(buf + len, size - len, dtp->fmt,
1545 dtp->data1, dtp->data2, dtp->data3);
1547 if (phba->nvmeio_trc_output_idx >= phba->nvmeio_trc_size) {
1548 phba->nvmeio_trc_output_idx = 0;
1549 - len += snprintf(buf + len, size - len,
1550 + len += scnprintf(buf + len, size - len,
1551 "Trace Complete\n");
1555 if (len >= (size - LPFC_DEBUG_OUT_LINE_SZ)) {
1556 - len += snprintf(buf + len, size - len,
1557 + len += scnprintf(buf + len, size - len,
1558 "Trace Continue (%d of %d)\n",
1559 phba->nvmeio_trc_output_idx,
1560 phba->nvmeio_trc_size);
1561 @@ -1276,7 +1278,7 @@ lpfc_debugfs_nvmeio_trc_data(struct lpfc
1565 - len += snprintf(buf + len, size - len,
1566 + len += scnprintf(buf + len, size - len,
1570 @@ -1308,39 +1310,39 @@ lpfc_debugfs_cpucheck_data(struct lpfc_v
1572 if (phba->nvmet_support == 0) {
1573 /* NVME Initiator */
1574 - len += snprintf(buf + len, PAGE_SIZE - len,
1575 + len += scnprintf(buf + len, PAGE_SIZE - len,
1577 (phba->cpucheck_on & LPFC_CHECK_NVME_IO ?
1578 "Enabled" : "Disabled"));
1579 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) {
1580 if (i >= LPFC_CHECK_CPU_CNT)
1582 - len += snprintf(buf + len, PAGE_SIZE - len,
1583 + len += scnprintf(buf + len, PAGE_SIZE - len,
1584 "%02d: xmit x%08x cmpl x%08x\n",
1585 i, phba->cpucheck_xmt_io[i],
1586 phba->cpucheck_cmpl_io[i]);
1587 tot_xmt += phba->cpucheck_xmt_io[i];
1588 tot_cmpl += phba->cpucheck_cmpl_io[i];
1590 - len += snprintf(buf + len, PAGE_SIZE - len,
1591 + len += scnprintf(buf + len, PAGE_SIZE - len,
1592 "tot:xmit x%08x cmpl x%08x\n",
1598 - len += snprintf(buf + len, PAGE_SIZE - len,
1599 + len += scnprintf(buf + len, PAGE_SIZE - len,
1601 (phba->cpucheck_on & LPFC_CHECK_NVMET_IO ?
1602 "IO Enabled - " : "IO Disabled - "));
1603 - len += snprintf(buf + len, PAGE_SIZE - len,
1604 + len += scnprintf(buf + len, PAGE_SIZE - len,
1606 (phba->cpucheck_on & LPFC_CHECK_NVMET_RCV ?
1607 "Rcv Enabled\n" : "Rcv Disabled\n"));
1608 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) {
1609 if (i >= LPFC_CHECK_CPU_CNT)
1611 - len += snprintf(buf + len, PAGE_SIZE - len,
1612 + len += scnprintf(buf + len, PAGE_SIZE - len,
1613 "%02d: xmit x%08x ccmpl x%08x "
1614 "cmpl x%08x rcv x%08x\n",
1615 i, phba->cpucheck_xmt_io[i],
1616 @@ -1352,7 +1354,7 @@ lpfc_debugfs_cpucheck_data(struct lpfc_v
1617 tot_cmpl += phba->cpucheck_cmpl_io[i];
1618 tot_ccmpl += phba->cpucheck_ccmpl_io[i];
1620 - len += snprintf(buf + len, PAGE_SIZE - len,
1621 + len += scnprintf(buf + len, PAGE_SIZE - len,
1622 "tot:xmit x%08x ccmpl x%08x cmpl x%08x rcv x%08x\n",
1623 tot_xmt, tot_ccmpl, tot_cmpl, tot_rcv);
1625 @@ -1797,28 +1799,29 @@ lpfc_debugfs_dif_err_read(struct file *f
1628 if (dent == phba->debug_writeGuard)
1629 - cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wgrd_cnt);
1630 + cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wgrd_cnt);
1631 else if (dent == phba->debug_writeApp)
1632 - cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wapp_cnt);
1633 + cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wapp_cnt);
1634 else if (dent == phba->debug_writeRef)
1635 - cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wref_cnt);
1636 + cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wref_cnt);
1637 else if (dent == phba->debug_readGuard)
1638 - cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rgrd_cnt);
1639 + cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rgrd_cnt);
1640 else if (dent == phba->debug_readApp)
1641 - cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rapp_cnt);
1642 + cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rapp_cnt);
1643 else if (dent == phba->debug_readRef)
1644 - cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rref_cnt);
1645 + cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rref_cnt);
1646 else if (dent == phba->debug_InjErrNPortID)
1647 - cnt = snprintf(cbuf, 32, "0x%06x\n", phba->lpfc_injerr_nportid);
1648 + cnt = scnprintf(cbuf, 32, "0x%06x\n",
1649 + phba->lpfc_injerr_nportid);
1650 else if (dent == phba->debug_InjErrWWPN) {
1651 memcpy(&tmp, &phba->lpfc_injerr_wwpn, sizeof(struct lpfc_name));
1652 tmp = cpu_to_be64(tmp);
1653 - cnt = snprintf(cbuf, 32, "0x%016llx\n", tmp);
1654 + cnt = scnprintf(cbuf, 32, "0x%016llx\n", tmp);
1655 } else if (dent == phba->debug_InjErrLBA) {
1656 if (phba->lpfc_injerr_lba == (sector_t)(-1))
1657 - cnt = snprintf(cbuf, 32, "off\n");
1658 + cnt = scnprintf(cbuf, 32, "off\n");
1660 - cnt = snprintf(cbuf, 32, "0x%llx\n",
1661 + cnt = scnprintf(cbuf, 32, "0x%llx\n",
1662 (uint64_t) phba->lpfc_injerr_lba);
1664 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1665 @@ -2624,17 +2627,17 @@ lpfc_idiag_pcicfg_read(struct file *file
1667 case SIZE_U8: /* byte (8 bits) */
1668 pci_read_config_byte(pdev, where, &u8val);
1669 - len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1670 + len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1671 "%03x: %02x\n", where, u8val);
1673 case SIZE_U16: /* word (16 bits) */
1674 pci_read_config_word(pdev, where, &u16val);
1675 - len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1676 + len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1677 "%03x: %04x\n", where, u16val);
1679 case SIZE_U32: /* double word (32 bits) */
1680 pci_read_config_dword(pdev, where, &u32val);
1681 - len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1682 + len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1683 "%03x: %08x\n", where, u32val);
1685 case LPFC_PCI_CFG_BROWSE: /* browse all */
1686 @@ -2654,25 +2657,25 @@ pcicfg_browse:
1687 offset = offset_label;
1689 /* Read PCI config space */
1690 - len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1691 + len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1692 "%03x: ", offset_label);
1694 pci_read_config_dword(pdev, offset, &u32val);
1695 - len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1696 + len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1698 offset += sizeof(uint32_t);
1699 if (offset >= LPFC_PCI_CFG_SIZE) {
1700 - len += snprintf(pbuffer+len,
1701 + len += scnprintf(pbuffer+len,
1702 LPFC_PCI_CFG_SIZE-len, "\n");
1705 index -= sizeof(uint32_t);
1707 - len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1708 + len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1710 else if (!(index % (8 * sizeof(uint32_t)))) {
1711 offset_label += (8 * sizeof(uint32_t));
1712 - len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1713 + len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
1714 "\n%03x: ", offset_label);
1717 @@ -2943,7 +2946,7 @@ lpfc_idiag_baracc_read(struct file *file
1718 if (acc_range == SINGLE_WORD) {
1719 offset_run = offset;
1720 u32val = readl(mem_mapped_bar + offset_run);
1721 - len += snprintf(pbuffer+len, LPFC_PCI_BAR_RD_BUF_SIZE-len,
1722 + len += scnprintf(pbuffer+len, LPFC_PCI_BAR_RD_BUF_SIZE-len,
1723 "%05x: %08x\n", offset_run, u32val);
1726 @@ -2957,35 +2960,35 @@ baracc_browse:
1727 offset_run = offset_label;
1729 /* Read PCI bar memory mapped space */
1730 - len += snprintf(pbuffer+len, LPFC_PCI_BAR_RD_BUF_SIZE-len,
1731 + len += scnprintf(pbuffer+len, LPFC_PCI_BAR_RD_BUF_SIZE-len,
1732 "%05x: ", offset_label);
1733 index = LPFC_PCI_BAR_RD_SIZE;
1735 u32val = readl(mem_mapped_bar + offset_run);
1736 - len += snprintf(pbuffer+len, LPFC_PCI_BAR_RD_BUF_SIZE-len,
1737 + len += scnprintf(pbuffer+len, LPFC_PCI_BAR_RD_BUF_SIZE-len,
1739 offset_run += sizeof(uint32_t);
1740 if (acc_range == LPFC_PCI_BAR_BROWSE) {
1741 if (offset_run >= bar_size) {
1742 - len += snprintf(pbuffer+len,
1743 + len += scnprintf(pbuffer+len,
1744 LPFC_PCI_BAR_RD_BUF_SIZE-len, "\n");
1748 if (offset_run >= offset +
1749 (acc_range * sizeof(uint32_t))) {
1750 - len += snprintf(pbuffer+len,
1751 + len += scnprintf(pbuffer+len,
1752 LPFC_PCI_BAR_RD_BUF_SIZE-len, "\n");
1756 index -= sizeof(uint32_t);
1758 - len += snprintf(pbuffer+len,
1759 + len += scnprintf(pbuffer+len,
1760 LPFC_PCI_BAR_RD_BUF_SIZE-len, "\n");
1761 else if (!(index % (8 * sizeof(uint32_t)))) {
1762 offset_label += (8 * sizeof(uint32_t));
1763 - len += snprintf(pbuffer+len,
1764 + len += scnprintf(pbuffer+len,
1765 LPFC_PCI_BAR_RD_BUF_SIZE-len,
1766 "\n%05x: ", offset_label);
1768 @@ -3158,19 +3161,19 @@ __lpfc_idiag_print_wq(struct lpfc_queue
1772 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1773 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1774 "\t\t%s WQ info: ", wqtype);
1775 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1776 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1777 "AssocCQID[%04d]: WQ-STAT[oflow:x%x posted:x%llx]\n",
1778 qp->assoc_qid, qp->q_cnt_1,
1779 (unsigned long long)qp->q_cnt_4);
1780 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1781 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1782 "\t\tWQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
1783 "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]",
1784 qp->queue_id, qp->entry_count,
1785 qp->entry_size, qp->host_index,
1786 qp->hba_index, qp->entry_repost);
1787 - len += snprintf(pbuffer + len,
1788 + len += scnprintf(pbuffer + len,
1789 LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
1792 @@ -3208,21 +3211,21 @@ __lpfc_idiag_print_cq(struct lpfc_queue
1796 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1797 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1798 "\t%s CQ info: ", cqtype);
1799 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1800 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1801 "AssocEQID[%02d]: CQ STAT[max:x%x relw:x%x "
1802 "xabt:x%x wq:x%llx]\n",
1803 qp->assoc_qid, qp->q_cnt_1, qp->q_cnt_2,
1804 qp->q_cnt_3, (unsigned long long)qp->q_cnt_4);
1805 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1806 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1807 "\tCQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
1808 "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]",
1809 qp->queue_id, qp->entry_count,
1810 qp->entry_size, qp->host_index,
1811 qp->hba_index, qp->entry_repost);
1813 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
1814 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
1818 @@ -3234,19 +3237,19 @@ __lpfc_idiag_print_rqpair(struct lpfc_qu
1822 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1823 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1824 "\t\t%s RQ info: ", rqtype);
1825 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1826 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1827 "AssocCQID[%02d]: RQ-STAT[nopost:x%x nobuf:x%x "
1828 "posted:x%x rcv:x%llx]\n",
1829 qp->assoc_qid, qp->q_cnt_1, qp->q_cnt_2,
1830 qp->q_cnt_3, (unsigned long long)qp->q_cnt_4);
1831 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1832 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1833 "\t\tHQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
1834 "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]\n",
1835 qp->queue_id, qp->entry_count, qp->entry_size,
1836 qp->host_index, qp->hba_index, qp->entry_repost);
1837 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1838 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1839 "\t\tDQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
1840 "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]\n",
1841 datqp->queue_id, datqp->entry_count,
1842 @@ -3331,17 +3334,17 @@ __lpfc_idiag_print_eq(struct lpfc_queue
1846 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1847 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1848 "\n%s EQ info: EQ-STAT[max:x%x noE:x%x "
1849 "cqe_proc:x%x eqe_proc:x%llx eqd %d]\n",
1850 eqtype, qp->q_cnt_1, qp->q_cnt_2, qp->q_cnt_3,
1851 (unsigned long long)qp->q_cnt_4, qp->q_mode);
1852 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1853 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1854 "EQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
1855 "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]",
1856 qp->queue_id, qp->entry_count, qp->entry_size,
1857 qp->host_index, qp->hba_index, qp->entry_repost);
1858 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
1859 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
1863 @@ -3399,7 +3402,7 @@ lpfc_idiag_queinfo_read(struct file *fil
1864 if (phba->cfg_fof == 0)
1865 phba->lpfc_idiag_last_eq = 0;
1867 - len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1868 + len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
1869 "EQ %d out of %d HBA EQs\n",
1870 x, phba->io_channel_irqs);
1872 @@ -3512,7 +3515,7 @@ fof:
1873 return simple_read_from_buffer(buf, nbytes, ppos, pbuffer, len);
1876 - len += snprintf(pbuffer + len,
1877 + len += scnprintf(pbuffer + len,
1878 LPFC_QUE_INFO_GET_BUF_SIZE - len, "Truncated ...\n");
1880 spin_unlock_irq(&phba->hbalock);
1881 @@ -3568,22 +3571,22 @@ lpfc_idiag_queacc_read_qe(char *pbuffer,
1884 esize = pque->entry_size;
1885 - len += snprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len,
1886 + len += scnprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len,
1887 "QE-INDEX[%04d]:\n", index);
1890 pentry = pque->qe[index].address;
1892 - len += snprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len,
1893 + len += scnprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len,
1896 offset += sizeof(uint32_t);
1897 esize -= sizeof(uint32_t);
1898 if (esize > 0 && !(offset % (4 * sizeof(uint32_t))))
1899 - len += snprintf(pbuffer+len,
1900 + len += scnprintf(pbuffer+len,
1901 LPFC_QUE_ACC_BUF_SIZE-len, "\n");
1903 - len += snprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len, "\n");
1904 + len += scnprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len, "\n");
1908 @@ -3989,27 +3992,27 @@ lpfc_idiag_drbacc_read_reg(struct lpfc_h
1912 - len += snprintf(pbuffer + len, LPFC_DRB_ACC_BUF_SIZE-len,
1913 + len += scnprintf(pbuffer + len, LPFC_DRB_ACC_BUF_SIZE-len,
1914 "EQ-DRB-REG: 0x%08x\n",
1915 readl(phba->sli4_hba.EQDBregaddr));
1918 - len += snprintf(pbuffer + len, LPFC_DRB_ACC_BUF_SIZE - len,
1919 + len += scnprintf(pbuffer + len, LPFC_DRB_ACC_BUF_SIZE - len,
1920 "CQ-DRB-REG: 0x%08x\n",
1921 readl(phba->sli4_hba.CQDBregaddr));
1924 - len += snprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len,
1925 + len += scnprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len,
1926 "MQ-DRB-REG: 0x%08x\n",
1927 readl(phba->sli4_hba.MQDBregaddr));
1930 - len += snprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len,
1931 + len += scnprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len,
1932 "WQ-DRB-REG: 0x%08x\n",
1933 readl(phba->sli4_hba.WQDBregaddr));
1936 - len += snprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len,
1937 + len += scnprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len,
1938 "RQ-DRB-REG: 0x%08x\n",
1939 readl(phba->sli4_hba.RQDBregaddr));
1941 @@ -4199,37 +4202,37 @@ lpfc_idiag_ctlacc_read_reg(struct lpfc_h
1944 case LPFC_CTL_PORT_SEM:
1945 - len += snprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len,
1946 + len += scnprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len,
1947 "Port SemReg: 0x%08x\n",
1948 readl(phba->sli4_hba.conf_regs_memmap_p +
1949 LPFC_CTL_PORT_SEM_OFFSET));
1951 case LPFC_CTL_PORT_STA:
1952 - len += snprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len,
1953 + len += scnprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len,
1954 "Port StaReg: 0x%08x\n",
1955 readl(phba->sli4_hba.conf_regs_memmap_p +
1956 LPFC_CTL_PORT_STA_OFFSET));
1958 case LPFC_CTL_PORT_CTL:
1959 - len += snprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len,
1960 + len += scnprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len,
1961 "Port CtlReg: 0x%08x\n",
1962 readl(phba->sli4_hba.conf_regs_memmap_p +
1963 LPFC_CTL_PORT_CTL_OFFSET));
1965 case LPFC_CTL_PORT_ER1:
1966 - len += snprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len,
1967 + len += scnprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len,
1968 "Port Er1Reg: 0x%08x\n",
1969 readl(phba->sli4_hba.conf_regs_memmap_p +
1970 LPFC_CTL_PORT_ER1_OFFSET));
1972 case LPFC_CTL_PORT_ER2:
1973 - len += snprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len,
1974 + len += scnprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len,
1975 "Port Er2Reg: 0x%08x\n",
1976 readl(phba->sli4_hba.conf_regs_memmap_p +
1977 LPFC_CTL_PORT_ER2_OFFSET));
1979 case LPFC_CTL_PDEV_CTL:
1980 - len += snprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len,
1981 + len += scnprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len,
1982 "PDev CtlReg: 0x%08x\n",
1983 readl(phba->sli4_hba.conf_regs_memmap_p +
1984 LPFC_CTL_PDEV_CTL_OFFSET));
1985 @@ -4422,13 +4425,13 @@ lpfc_idiag_mbxacc_get_setup(struct lpfc_
1986 mbx_dump_cnt = idiag.cmd.data[IDIAG_MBXACC_DPCNT_INDX];
1987 mbx_word_cnt = idiag.cmd.data[IDIAG_MBXACC_WDCNT_INDX];
1989 - len += snprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len,
1990 + len += scnprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len,
1991 "mbx_dump_map: 0x%08x\n", mbx_dump_map);
1992 - len += snprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len,
1993 + len += scnprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len,
1994 "mbx_dump_cnt: %04d\n", mbx_dump_cnt);
1995 - len += snprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len,
1996 + len += scnprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len,
1997 "mbx_word_cnt: %04d\n", mbx_word_cnt);
1998 - len += snprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len,
1999 + len += scnprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len,
2000 "mbx_mbox_cmd: 0x%02x\n", mbx_mbox_cmd);
2003 @@ -4577,35 +4580,35 @@ lpfc_idiag_extacc_avail_get(struct lpfc_
2005 uint16_t ext_cnt, ext_size;
2007 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2008 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2009 "\nAvailable Extents Information:\n");
2011 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2012 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2013 "\tPort Available VPI extents: ");
2014 lpfc_sli4_get_avail_extnt_rsrc(phba, LPFC_RSC_TYPE_FCOE_VPI,
2015 &ext_cnt, &ext_size);
2016 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2017 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2018 "Count %3d, Size %3d\n", ext_cnt, ext_size);
2020 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2021 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2022 "\tPort Available VFI extents: ");
2023 lpfc_sli4_get_avail_extnt_rsrc(phba, LPFC_RSC_TYPE_FCOE_VFI,
2024 &ext_cnt, &ext_size);
2025 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2026 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2027 "Count %3d, Size %3d\n", ext_cnt, ext_size);
2029 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2030 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2031 "\tPort Available RPI extents: ");
2032 lpfc_sli4_get_avail_extnt_rsrc(phba, LPFC_RSC_TYPE_FCOE_RPI,
2033 &ext_cnt, &ext_size);
2034 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2035 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2036 "Count %3d, Size %3d\n", ext_cnt, ext_size);
2038 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2039 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2040 "\tPort Available XRI extents: ");
2041 lpfc_sli4_get_avail_extnt_rsrc(phba, LPFC_RSC_TYPE_FCOE_XRI,
2042 &ext_cnt, &ext_size);
2043 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2044 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2045 "Count %3d, Size %3d\n", ext_cnt, ext_size);
2048 @@ -4629,55 +4632,55 @@ lpfc_idiag_extacc_alloc_get(struct lpfc_
2049 uint16_t ext_cnt, ext_size;
2052 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2053 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2054 "\nAllocated Extents Information:\n");
2056 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2057 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2058 "\tHost Allocated VPI extents: ");
2059 rc = lpfc_sli4_get_allocated_extnts(phba, LPFC_RSC_TYPE_FCOE_VPI,
2060 &ext_cnt, &ext_size);
2062 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2063 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2064 "Port %d Extent %3d, Size %3d\n",
2065 phba->brd_no, ext_cnt, ext_size);
2067 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2068 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2071 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2072 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2073 "\tHost Allocated VFI extents: ");
2074 rc = lpfc_sli4_get_allocated_extnts(phba, LPFC_RSC_TYPE_FCOE_VFI,
2075 &ext_cnt, &ext_size);
2077 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2078 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2079 "Port %d Extent %3d, Size %3d\n",
2080 phba->brd_no, ext_cnt, ext_size);
2082 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2083 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2086 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2087 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2088 "\tHost Allocated RPI extents: ");
2089 rc = lpfc_sli4_get_allocated_extnts(phba, LPFC_RSC_TYPE_FCOE_RPI,
2090 &ext_cnt, &ext_size);
2092 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2093 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2094 "Port %d Extent %3d, Size %3d\n",
2095 phba->brd_no, ext_cnt, ext_size);
2097 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2098 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2101 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2102 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2103 "\tHost Allocated XRI extents: ");
2104 rc = lpfc_sli4_get_allocated_extnts(phba, LPFC_RSC_TYPE_FCOE_XRI,
2105 &ext_cnt, &ext_size);
2107 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2108 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2109 "Port %d Extent %3d, Size %3d\n",
2110 phba->brd_no, ext_cnt, ext_size);
2112 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2113 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2117 @@ -4701,49 +4704,49 @@ lpfc_idiag_extacc_drivr_get(struct lpfc_
2118 struct lpfc_rsrc_blks *rsrc_blks;
2121 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2122 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2123 "\nDriver Extents Information:\n");
2125 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2126 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2127 "\tVPI extents:\n");
2129 list_for_each_entry(rsrc_blks, &phba->lpfc_vpi_blk_list, list) {
2130 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2131 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2132 "\t\tBlock %3d: Start %4d, Count %4d\n",
2133 index, rsrc_blks->rsrc_start,
2134 rsrc_blks->rsrc_size);
2137 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2138 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2139 "\tVFI extents:\n");
2141 list_for_each_entry(rsrc_blks, &phba->sli4_hba.lpfc_vfi_blk_list,
2143 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2144 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2145 "\t\tBlock %3d: Start %4d, Count %4d\n",
2146 index, rsrc_blks->rsrc_start,
2147 rsrc_blks->rsrc_size);
2151 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2152 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2153 "\tRPI extents:\n");
2155 list_for_each_entry(rsrc_blks, &phba->sli4_hba.lpfc_rpi_blk_list,
2157 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2158 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2159 "\t\tBlock %3d: Start %4d, Count %4d\n",
2160 index, rsrc_blks->rsrc_start,
2161 rsrc_blks->rsrc_size);
2165 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2166 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2167 "\tXRI extents:\n");
2169 list_for_each_entry(rsrc_blks, &phba->sli4_hba.lpfc_xri_blk_list,
2171 - len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2172 + len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len,
2173 "\t\tBlock %3d: Start %4d, Count %4d\n",
2174 index, rsrc_blks->rsrc_start,
2175 rsrc_blks->rsrc_size);
2176 @@ -5137,11 +5140,11 @@ lpfc_idiag_mbxacc_dump_bsg_mbox(struct l
2178 pr_err("%s\n", line_buf);
2180 - len += snprintf(line_buf+len,
2181 + len += scnprintf(line_buf+len,
2182 LPFC_MBX_ACC_LBUF_SZ-len,
2185 - len += snprintf(line_buf+len, LPFC_MBX_ACC_LBUF_SZ-len,
2186 + len += scnprintf(line_buf+len, LPFC_MBX_ACC_LBUF_SZ-len,
2187 "%08x ", (uint32_t)*pword);
2190 @@ -5204,11 +5207,11 @@ lpfc_idiag_mbxacc_dump_issue_mbox(struct
2191 pr_err("%s\n", line_buf);
2193 memset(line_buf, 0, LPFC_MBX_ACC_LBUF_SZ);
2194 - len += snprintf(line_buf+len,
2195 + len += scnprintf(line_buf+len,
2196 LPFC_MBX_ACC_LBUF_SZ-len,
2199 - len += snprintf(line_buf+len, LPFC_MBX_ACC_LBUF_SZ-len,
2200 + len += scnprintf(line_buf+len, LPFC_MBX_ACC_LBUF_SZ-len,
2202 ((uint32_t)*pword) & 0xffffffff);
2204 @@ -5227,18 +5230,18 @@ lpfc_idiag_mbxacc_dump_issue_mbox(struct
2205 pr_err("%s\n", line_buf);
2207 memset(line_buf, 0, LPFC_MBX_ACC_LBUF_SZ);
2208 - len += snprintf(line_buf+len,
2209 + len += scnprintf(line_buf+len,
2210 LPFC_MBX_ACC_LBUF_SZ-len,
2213 for (j = 0; j < 4; j++) {
2214 - len += snprintf(line_buf+len,
2215 + len += scnprintf(line_buf+len,
2216 LPFC_MBX_ACC_LBUF_SZ-len,
2218 ((uint8_t)*pbyte) & 0xff);
2221 - len += snprintf(line_buf+len,
2222 + len += scnprintf(line_buf+len,
2223 LPFC_MBX_ACC_LBUF_SZ-len, " ");
2226 --- a/drivers/scsi/lpfc/lpfc_debugfs.h
2227 +++ b/drivers/scsi/lpfc/lpfc_debugfs.h
2228 @@ -342,7 +342,7 @@ lpfc_debug_dump_qe(struct lpfc_queue *q,
2229 pword = q->qe[idx].address;
2232 - len += snprintf(line_buf+len, LPFC_LBUF_SZ-len, "QE[%04d]: ", idx);
2233 + len += scnprintf(line_buf+len, LPFC_LBUF_SZ-len, "QE[%04d]: ", idx);
2234 if (qe_word_cnt > 8)
2235 printk(KERN_ERR "%s\n", line_buf);
2237 @@ -353,11 +353,11 @@ lpfc_debug_dump_qe(struct lpfc_queue *q,
2238 if (qe_word_cnt > 8) {
2240 memset(line_buf, 0, LPFC_LBUF_SZ);
2241 - len += snprintf(line_buf+len, LPFC_LBUF_SZ-len,
2242 + len += scnprintf(line_buf+len, LPFC_LBUF_SZ-len,
2246 - len += snprintf(line_buf+len, LPFC_LBUF_SZ-len, "%08x ",
2247 + len += scnprintf(line_buf+len, LPFC_LBUF_SZ-len, "%08x ",
2248 ((uint32_t)*pword) & 0xffffffff);