Skip to content

Commit 2b3bdef

Browse files
njavaligregkh
authored andcommitted
scsi: qla2xxx: Array index may go out of bound
commit d721b59 upstream. Klocwork reports array 'vha->host_str' of size 16 may use index value(s) 16..19. Use snprintf() instead of sprintf(). Cc: [email protected] Co-developed-by: Bikash Hazarika <[email protected]> Signed-off-by: Bikash Hazarika <[email protected]> Signed-off-by: Nilesh Javali <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d994ac7 commit 2b3bdef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5074,7 +5074,8 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht,
50745074
}
50755075
INIT_DELAYED_WORK(&vha->scan.scan_work, qla_scan_work_fn);
50765076

5077-
sprintf(vha->host_str, "%s_%lu", QLA2XXX_DRIVER_NAME, vha->host_no);
5077+
snprintf(vha->host_str, sizeof(vha->host_str), "%s_%lu",
5078+
QLA2XXX_DRIVER_NAME, vha->host_no);
50785079
ql_dbg(ql_dbg_init, vha, 0x0041,
50795080
"Allocated the host=%p hw=%p vha=%p dev_name=%s",
50805081
vha->host, vha->hw, vha,

0 commit comments

Comments
 (0)