On 7/25/19, 12:54 AM, "linux-scsi-owner@xxxxxxxxxxxxxxx on behalf of Wang Xiayang" <linux-scsi-owner@xxxxxxxxxxxxxxx on behalf of xywang.sjtu@xxxxxxxxxxx> wrote: As commit a86028f8e3ee ("staging: most: sound: replace snprintf with strscpy") suggested, using snprintf without a format specifier is potentially risky if a0->vendor_name or a0->vendor_pn mistakenly contain format specifiers. In addition, as compared in the implementation, strscpy looks more light-weight than snprintf. This patch does not incur any functional change. Signed-off-by: Wang Xiayang <xywang.sjtu@xxxxxxxxxxx> --- drivers/scsi/qla2xxx/qla_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 4059655639d9..068b54218ff4 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3461,12 +3461,12 @@ static void qla2xxx_print_sfp_info(struct scsi_qla_host *vha) int leftover, len; memset(str, 0, STR_LEN); - snprintf(str, SFF_VEN_NAME_LEN+1, a0->vendor_name); + strscpy(str, a0->vendor_name, SFF_VEN_NAME_LEN+1); ql_dbg(ql_dbg_init, vha, 0x015a, "SFP MFG Name: %s\n", str); memset(str, 0, STR_LEN); - snprintf(str, SFF_PART_NAME_LEN+1, a0->vendor_pn); + strscpy(str, a0->vendor_pn, SFF_PART_NAME_LEN+1); ql_dbg(ql_dbg_init, vha, 0x015c, "SFP Part Name: %s\n", str); -- 2.11.0 Looks Good. Acked-by: Himanshu Madhani <hmadhani@xxxxxxxxxxx>