Skip to contentSkip to conversation

FAILED: patch "[PATCH] scsi: qla2xxx: Correct the index of array" failed to apply to 4.14-stable tree

PATCH [email protected] 1 participant 1 message Jul 21, 2023

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.14-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 <[email protected]>.

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.14.y
git checkout FETCH_HEAD
git cherry-pick -x b1b9d3825df4c757d653d0b1df66f084835db9c3
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023072113-unveiling-lizard-c937@gregkh' --subject-prefix 'PATCH 4.14.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 <[email protected]>
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.

drivers/scsi/qla2xxx/qla_inline.h +4 -1
index cce6e425c121..946a39504a35 100644
@@ -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;
 		}