From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C265AC04A94 for ; Fri, 21 Jul 2023 14:43:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230245AbjGUOnI (ORCPT ); Fri, 21 Jul 2023 10:43:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231859AbjGUOmz (ORCPT ); Fri, 21 Jul 2023 10:42:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 550FC30C8 for ; Fri, 21 Jul 2023 07:42:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E551661CB8 for ; Fri, 21 Jul 2023 14:42:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F422DC433C9; Fri, 21 Jul 2023 14:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689950571; bh=wMC038u7YatDRzO3glal1C79Vp0FxjC14c6pFItE8mY=; h=Subject:To:Cc:From:Date:From; b=ZFDL8vdi+f9WrpLlDKDmDPyKgnNBEzn8nA1zclv83HC30NykGDU7JhP6bWHtRK4+C Nb2uO2QRUi3HPqApSoYM9AgPN4Hip04lsvPrGsGrtnwmtX5pUHz83I5w9RPYBYczPi tSBR5j8qATouRgQ9eKjrMmd9hMuswAkEW51CzlQc= Subject: FAILED: patch "[PATCH] scsi: qla2xxx: Array index may go out of bound" failed to apply to 4.19-stable tree To: njavali@marvell.com, bhazarika@marvell.com, himanshu.madhani@oracle.com, martin.petersen@oracle.com Cc: From: Date: Fri, 21 Jul 2023 16:42:40 +0200 Message-ID: <2023072140-dilute-stood-1935@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.19.y git checkout FETCH_HEAD git cherry-pick -x d721b591b95cf3f290f8a7cbe90aa2ee0368388d # git commit -s git send-email --to '' --in-reply-to '2023072140-dilute-stood-1935@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^.. Possible dependencies: d721b591b95c ("scsi: qla2xxx: Array index may go out of bound") 250bd00923c7 ("scsi: qla2xxx: Fix inconsistent format argument type in qla_os.c") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From d721b591b95cf3f290f8a7cbe90aa2ee0368388d Mon Sep 17 00:00:00 2001 From: Nilesh Javali Date: Wed, 7 Jun 2023 17:08:36 +0530 Subject: [PATCH] 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: stable@vger.kernel.org Co-developed-by: Bikash Hazarika Signed-off-by: Bikash Hazarika Signed-off-by: Nilesh Javali Link: https://lore.kernel.org/r/20230607113843.37185-2-njavali@marvell.com Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index bc89d3da8fd0..3bace9ea6288 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -5088,7 +5088,8 @@ struct scsi_qla_host *qla2x00_create_host(const struct scsi_host_template *sht, } INIT_DELAYED_WORK(&vha->scan.scan_work, qla_scan_work_fn); - sprintf(vha->host_str, "%s_%lu", QLA2XXX_DRIVER_NAME, vha->host_no); + snprintf(vha->host_str, sizeof(vha->host_str), "%s_%lu", + QLA2XXX_DRIVER_NAME, vha->host_no); ql_dbg(ql_dbg_init, vha, 0x0041, "Allocated the host=%p hw=%p vha=%p dev_name=%s", vha->host, vha->hw, vha,