Skip to content

Commit 15d2586

Browse files
KAGA-KOKOmartinkpetersen
authored andcommitted
scsi: qedi: Fix a potential buffer overflow
Tell snprintf() to store at most 255 characters in the output buffer instead of 256. This patch avoids that smatch reports the following warning: drivers/scsi/qedi/qedi_main.c:891: qedi_get_boot_tgt_info() error: snprintf() is printing too much 256 vs 255 Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: <QLogic-Storage-Upstream@cavium.com> Cc: <stable@vger.kernel.org> Acked-by: Nilesh Javali <nilesh.javali@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 5e53be8 commit 15d2586

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/qedi/qedi_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ static void qedi_get_boot_tgt_info(struct nvm_iscsi_block *block,
888888
ipv6_en = !!(block->generic.ctrl_flags &
889889
NVM_ISCSI_CFG_GEN_IPV6_ENABLED);
890890

891-
snprintf(tgt->iscsi_name, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, "%s\n",
891+
snprintf(tgt->iscsi_name, sizeof(tgt->iscsi_name), "%s\n",
892892
block->target[index].target_name.byte);
893893

894894
tgt->ipv6_en = ipv6_en;

0 commit comments

Comments
 (0)