From: Greg Kroah-Hartman Date: Wed, 30 Aug 2017 14:39:08 +0000 (+0200) Subject: 4.4-stable patches X-Git-Tag: v3.18.69~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=888fe6bfd7e3e563921a7454ae64df28542a717b;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: scsi-isci-avoid-array-subscript-warning.patch --- diff --git a/queue-4.4/scsi-isci-avoid-array-subscript-warning.patch b/queue-4.4/scsi-isci-avoid-array-subscript-warning.patch new file mode 100644 index 00000000000..95533c69914 --- /dev/null +++ b/queue-4.4/scsi-isci-avoid-array-subscript-warning.patch @@ -0,0 +1,38 @@ +From 5cfa2a3c7342bd0b50716c8bb32ee491af43c785 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Fri, 18 Nov 2016 17:14:01 +0100 +Subject: scsi: isci: avoid array subscript warning + +From: Arnd Bergmann + +commit 5cfa2a3c7342bd0b50716c8bb32ee491af43c785 upstream. + +I'm getting a new warning with gcc-7: + +isci/remote_node_context.c: In function 'sci_remote_node_context_destruct': +isci/remote_node_context.c:69:16: error: array subscript is above array bounds [-Werror=array-bounds] + +This is odd, since we clearly cover all values for enum +scis_sds_remote_node_context_states here. Anyway, checking for an array +overflow can't harm and it makes the warning go away. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/isci/remote_node_context.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/scsi/isci/remote_node_context.c ++++ b/drivers/scsi/isci/remote_node_context.c +@@ -66,6 +66,9 @@ const char *rnc_state_name(enum scis_sds + { + static const char * const strings[] = RNC_STATES; + ++ if (state >= ARRAY_SIZE(strings)) ++ return "UNKNOWN"; ++ + return strings[state]; + } + #undef C