From patchwork Thu Apr 30 21:30:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11521677 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78B5D913 for ; Thu, 30 Apr 2020 21:34:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A712208C3 for ; Thu, 30 Apr 2020 21:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728107AbgD3VeK (ORCPT ); Thu, 30 Apr 2020 17:34:10 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:58935 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727124AbgD3VeI (ORCPT ); Thu, 30 Apr 2020 17:34:08 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MekrN-1iw23r0YOj-00apFq; Thu, 30 Apr 2020 23:33:54 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Intel SCU Linux support , Artur Paszkiewicz , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , linux-scsi@vger.kernel.org Subject: [PATCH 14/15] isci: avoid gcc-10 zero-length-bounds warning Date: Thu, 30 Apr 2020 23:30:56 +0200 Message-Id: <20200430213101.135134-15-arnd@arndb.de> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200430213101.135134-1-arnd@arndb.de> References: <20200430213101.135134-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:7STMyUCnzNFORsOTFhBk+QO1wMd0aCQREYl9i/6g5djgitDUpZ6 d1Cx+C01pHvqZt+aQoS8ab5L853K/yBtfnhyeugGS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ernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org gcc-10 warns about accesses to zero-length arrays: drivers/scsi/isci/task.h:125:31: error: array subscript 0 is outside the bounds of an interior zero-length array 'u8[0]' {aka 'unsigned char[0]'} [-Werror=zero-length-bounds] 125 | tmf->resp.resp_iu.resp_data[0], | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call' 143 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call' 157 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \ | ^~~~~~~~~~~~~~~~~~ include/linux/dev_printk.h:115:2: note: in expansion of macro 'dynamic_dev_dbg' 115 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~~~~~~~~~ drivers/scsi/isci/task.h:111:3: note: in expansion of macro 'dev_dbg' 111 | dev_dbg(&ihost->pdev->dev, | ^~~~~~~ In file included from include/scsi/libsas.h:15, from drivers/scsi/isci/task.c:59: include/scsi/sas.h:326:9: note: while referencing 'resp_data' 326 | u8 resp_data[0]; | ^~~~~~~~~ This instance is not a bug, so just work around the warning by adding a temporary pointer. Signed-off-by: Arnd Bergmann --- drivers/scsi/isci/task.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/isci/task.h b/drivers/scsi/isci/task.h index 8f4531f22ac2..2d556d7b5292 100644 --- a/drivers/scsi/isci/task.h +++ b/drivers/scsi/isci/task.h @@ -98,6 +98,8 @@ struct isci_tmf { static inline void isci_print_tmf(struct isci_host *ihost, struct isci_tmf *tmf) { + u8 *resp = tmf->resp.resp_iu.resp_data; + if (SAS_PROTOCOL_SATA == tmf->proto) dev_dbg(&ihost->pdev->dev, "%s: status = %x\n" @@ -122,10 +124,7 @@ static inline void isci_print_tmf(struct isci_host *ihost, struct isci_tmf *tmf) tmf->resp.resp_iu.datapres, tmf->resp.resp_iu.status, be32_to_cpu(tmf->resp.resp_iu.response_data_len), - tmf->resp.resp_iu.resp_data[0], - tmf->resp.resp_iu.resp_data[1], - tmf->resp.resp_iu.resp_data[2], - tmf->resp.resp_iu.resp_data[3]); + resp[0], resp[1], resp[2], resp[3]); }