Skip to content

Commit d721b59

Browse files
njavalimartinkpetersen
authored andcommitted
scsi: qla2xxx: Array index may go out of bound
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]>
1 parent eb91eb8 commit d721b59

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
@@ -5088,7 +5088,8 @@ struct scsi_qla_host *qla2x00_create_host(const struct scsi_host_template *sht,
50885088
}
50895089
INIT_DELAYED_WORK(&vha->scan.scan_work, qla_scan_work_fn);
50905090

5091-
sprintf(vha->host_str, "%s_%lu", QLA2XXX_DRIVER_NAME, vha->host_no);
5091+
snprintf(vha->host_str, sizeof(vha->host_str), "%s_%lu",
5092+
QLA2XXX_DRIVER_NAME, vha->host_no);
50925093
ql_dbg(ql_dbg_init, vha, 0x0041,
50935094
"Allocated the host=%p hw=%p vha=%p dev_name=%s",
50945095
vha->host, vha->hw, vha,

0 commit comments

Comments
 (0)