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 <stable@xxxxxxxxxxxxxxx>. 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 b1b9d3825df4c757d653d0b1df66f084835db9c3 # <resolve conflicts, build, test, etc.> git commit -s git send-email --to '<stable@xxxxxxxxxxxxxxx>' --in-reply-to '2023072112-plywood-delusion-dd8d@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^.. Possible dependencies: b1b9d3825df4 ("scsi: qla2xxx: Correct the index of array") 27258a577144 ("scsi: qla2xxx: Add a shadow variable to hold disc_state history of fcport") 58e39a2ce4be ("scsi: qla2xxx: Change discovery state before PLOGI") 983f127603fa ("scsi: qla2xxx: Retry PLOGI on FC-NVMe PRLI failure") c76ae845ea83 ("scsi: qla2xxx: Add error handling for PLOGI ELS passthrough") 84ed362ac40c ("scsi: qla2xxx: Dual FCP-NVMe target port support") f3f1938bb673 ("scsi: qla2xxx: Fix N2N link up fail") 7f2a398d59d6 ("scsi: qla2xxx: Fix N2N link reset") ce0ba496dccf ("scsi: qla2xxx: Fix stuck login session") 897def200421 ("scsi: qla2xxx: Inline the qla2x00_fcport_event_handler() function") 0184793df2e8 ("scsi: qla2xxx: Use tabs instead of spaces for indentation") a630bdc54f6d ("scsi: qla2xxx: Move qla2x00_set_fcport_state() from a .h into a .c file") bd432bb53cff ("scsi: qla2xxx: Leave a blank line after declarations") 2703eaaf4eae ("scsi: qla2xxx: Use tabs to indent code") a6a6d0589ac4 ("scsi: scsi_transport_fc: nvme: display FC-NVMe port roles") f8f97b0c5b7f ("scsi: qla2xxx: Cleanups for NVRAM/Flash read/write path") ecc89f25e225 ("scsi: qla2xxx: Add Device ID for ISP28XX") 24ef8f7eb5d0 ("scsi: qla2xxx: Fix routine qla27xx_dump_{mpi|ram}()") df617ffbbc5e ("scsi: qla2xxx: Add fw_attr and port_no SysFS node") 64f61d994483 ("scsi: qla2xxx: Add new FW dump template entry types") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From b1b9d3825df4c757d653d0b1df66f084835db9c3 Mon Sep 17 00:00:00 2001 From: Bikash Hazarika <bhazarika@xxxxxxxxxxx> Date: Wed, 7 Jun 2023 17:08:42 +0530 Subject: [PATCH] scsi: qla2xxx: Correct the index of array Klocwork reported array 'port_dstate_str' of size 10 may use index value(s) 10..15. Add a fix to correct the index of array. Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Bikash Hazarika <bhazarika@xxxxxxxxxxx> Signed-off-by: Nilesh Javali <njavali@xxxxxxxxxxx> Link: https://lore.kernel.org/r/20230607113843.37185-8-njavali@xxxxxxxxxxx Reviewed-by: Himanshu Madhani <himanshu.madhani@xxxxxxxxxx> Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index cce6e425c121..946a39504a35 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h @@ -109,11 +109,13 @@ qla2x00_set_fcport_disc_state(fc_port_t *fcport, int state) { int old_val; uint8_t shiftbits, mask; + uint8_t port_dstate_str_sz; /* This will have to change when the max no. of states > 16 */ shiftbits = 4; mask = (1 << shiftbits) - 1; + port_dstate_str_sz = sizeof(port_dstate_str) / sizeof(char *); fcport->disc_state = state; while (1) { old_val = atomic_read(&fcport->shadow_disc_state); @@ -121,7 +123,8 @@ qla2x00_set_fcport_disc_state(fc_port_t *fcport, int state) old_val, (old_val << shiftbits) | state)) { ql_dbg(ql_dbg_disc, fcport->vha, 0x2134, "FCPort %8phC disc_state transition: %s to %s - portid=%06x.\n", - fcport->port_name, port_dstate_str[old_val & mask], + fcport->port_name, (old_val & mask) < port_dstate_str_sz ? + port_dstate_str[old_val & mask] : "Unknown", port_dstate_str[state], fcport->d_id.b24); return; }