From patchwork Fri Nov 18 16:14:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101493 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp165986qge; Fri, 18 Nov 2016 08:14:41 -0800 (PST) X-Received: by 10.13.241.199 with SMTP id a190mr425722ywf.285.1479485681233; Fri, 18 Nov 2016 08:14:41 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b19si1845189ybg.241.2016.11.18.08.14.41 for ; Fri, 18 Nov 2016 08:14:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753565AbcKRQOj (ORCPT ); Fri, 18 Nov 2016 11:14:39 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:50709 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752323AbcKRQOi (ORCPT ); Fri, 18 Nov 2016 11:14:38 -0500 Received: from wuerfel.lan ([78.43.21.235]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lgw8E-1cb2ol2ovm-00oDh5; Fri, 18 Nov 2016 17:14:21 +0100 From: Arnd Bergmann To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Intel SCU Linux support , Artur Paszkiewicz , Bart Van Assche , Colin Ian King , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] isci: avoid array subscript warning Date: Fri, 18 Nov 2016 17:14:01 +0100 Message-Id: <20161118161418.755779-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:OMshlEiNnJPOptD0Pi2Xkjl1wVKBJICYngE45Ei/iyUTpCJKmr6 EDRi019RiNIFDgwlqUxncSiq57mBMn1hrSyiCEUf6rVBR7O8oyYSqKXwQgbZHRCq7IQzfb2 TXcwY0DMjlD8TbOvtaDXtvCjwXTUSfIHGpSToszoO9KB3IbbcYTiOT6XFRrFlTq9O/OwPRA FlPHA3vrzUGR9ZFzk9hZA== X-UI-Out-Filterresults: notjunk:1; V01:K0:Nlb921IXqUs=:6dkeVqH3pOjUkKK6nPDG2Q d8Fr7K/vgXN5VynMudToO4k1yVURd3M7EfQyagj77RXniA3cOGEAdMNjXf8IVsHmfHb5Aysv8 qSAM3/OMF8zQnTzdjRYl+8xlhdM5YTR4c1GrLVULCuINx3oRZP+CQC9x3gXbGcjc3ot4oAOrY ZfovS5ITFot9tC76alnSE0ykGwHUpaNApWm9A5q3fuzW1V/D+UzZORiuRbf9tonIAXgiLpTw3 Kef9sw/l92GEAvqMU7+LcXycH+e1upl15UGBfFqyb14pZL7eZQRkt2SdJy9TJ4snNTQS+kL1/ 2r5KfV1MAkxI5DIIB3Ovde4VFYq7n21u0ct+4uanqhDGJINiHehXW2RrzThLs9cfLBnop8ymJ pwacromPyCdrFHafI3ot215mtDlKk2ICwhzj5lCWuhbtlY5QPHKFq6sUKSE3UY+DlTgGQP9b5 Ltoe/yTy7qhLYMaIsaFORNWnLmlj1MXnCx9QZcz2S8GklG30S6rBmJ+P6K36VSHnKjf8tGIxT 2GO0jYvQ+wdEAFoja5UeXw7R05jTABEMZQDpTPfEnRmIAeKYj8lmn5P62lsrCzDzxJpV25PjZ h+dZBSJH3Wo6i6VN9ulv/UYLBYQQTI/8hLwH/+1GkKBj4b4d5F9ptAn1f3rF9M1uUPuLec8+S Jy0dLADzRekKbB6dqnunf7vt+qyHHyYcFLfEpGymVeW1wX4zVN0OPQH1stP0O4m54PRU= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org 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 --- drivers/scsi/isci/remote_node_context.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/isci/remote_node_context.c b/drivers/scsi/isci/remote_node_context.c index 30bd80052e03..e3f2a5359d71 100644 --- 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_remote_node_context_states state) { static const char * const strings[] = RNC_STATES; + if (state >= ARRAY_SIZE(strings)) + return "UNKNOWN"; + return strings[state]; } #undef C