Message ID | 20230105233042.never.913-kees@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp544820wrt; Thu, 5 Jan 2023 15:35:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXtHgb8kwRgo8OrImBjOU/5Wr2FND8UjivDuspVLcCOui3KXBr73xaBsBeJgOfzW+z01+EF5 X-Received: by 2002:a17:906:8492:b0:7c1:6b46:a722 with SMTP id m18-20020a170906849200b007c16b46a722mr46316586ejx.56.1672961720972; Thu, 05 Jan 2023 15:35:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672961720; cv=none; d=google.com; s=arc-20160816; b=rBzRtYJ1ta7WDCNHDSNWnuTnQ+f+HBPYErCLGjppG5enT9chOuyh24Di7EdmzwAA9I w08xocyucDap8LyWlPBgEHcz2opGlmJ2+efuLIlT6gbTQw1ozALvFx27potvYDi0LT4m 63aYyXyFioIn41kAphBi32M+mo89i0NwTatct1oIazvL7a088EegLPzo4JjSmVflFzYj eYi2RoiqU+6VEVLloxVzumiFMbL+VgahKEKSgGIOBHIGqPvchrjzF7xVO6OuVkHIoeS+ zF37VOGnPwMPaW3y/jvzebNFkRRIBqY8X6FTqfYBDjrClq9Je3BByMln6oUfqs1rPLOl aCkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=2kb9iyUzhyO/yRzb2MYwodXEuGzEEK2s/5ms6ha74TY=; b=x+Nvm15g+Uuo2ql2oTwYti3I+vBo3Ag0xi7KhgTmA8J2bWSziUp8qIZmGjSQhPJSRv 1r+BCjT7FljonGRT+zxwBWVccFtGchubIZnGGGh+LGT65DBzCoEERikogqbNt8W7/ocj G/dwt7q9Rt850VEAzBkTkhyz539HTuIsU8Ysxw0CSS72Xd5+Sx5XX5+LJOL8emlU12nT WidYERmze0cKJWw4DCQ/qOnu+QQOzj/8BpbFTSCcjL+D1PrUgc1dG+PVI4RTWUp0qrCf VC/rmj5Qa6fBwmDr/ihVM8NkfA08HnluEqg8SxEBHYb3PioluxVGydJgXgRhybYL2qYu YnXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=K2xGRq7G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ww2-20020a170907084200b007416e100f3dsi32452730ejb.986.2023.01.05.15.34.56; Thu, 05 Jan 2023 15:35:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=K2xGRq7G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235658AbjAEXaw (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Thu, 5 Jan 2023 18:30:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235045AbjAEXau (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 5 Jan 2023 18:30:50 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5032AB2 for <linux-kernel@vger.kernel.org>; Thu, 5 Jan 2023 15:30:49 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id e21so16929653pfl.1 for <linux-kernel@vger.kernel.org>; Thu, 05 Jan 2023 15:30:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2kb9iyUzhyO/yRzb2MYwodXEuGzEEK2s/5ms6ha74TY=; b=K2xGRq7G4hmwZEoqOU3XlLDiETKQHO9+A5b4Tov2tqJ+k8AEB6AO/1u/GQYNqkiLu2 dstWxDme7prx3+57EQ5zsDeSxJPWT7MGvnScvFWG1yPwcVl/8k+gHkoOkrRLzuupqmbM H6iBV0VDltRm+UguJYJwc6hiA1U7Y1dBKaqQQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2kb9iyUzhyO/yRzb2MYwodXEuGzEEK2s/5ms6ha74TY=; b=H069wLgRFuZzshMMphaCkFeGOO3hlK/94LcsvTj1C5EfketFW0C1ad7MGD6c/VOuAx ikhEiCVm3rVRTAw1TeyS7ZQ84uhnVmKf22KsDH8VSRgQff4Q1jZbj+my1825zsQtp01d 6J9wWtH+F1rpFHPth1DkPnqV0ZyPphyw1hWe95IOkHLPGeyOfk+3+dTzUzJI0DYaGqOo aUQo1f3svBXAMZdP2/e/h99HOWo9Lmfg8MZj1mCwEkoD5MTiglzZkcqngBntV9oObry3 PQBdzsv/ssG6w54vdzQPBrzOFhAXHr/Vg0TmlanUKihOVPmqUVv/x5tqZlM0nHTh5Fim ZWZA== X-Gm-Message-State: AFqh2kqNctteoNhiAM071SHLJQQWZZz79Kf1UbiqdKws7+jDcsb0EX86 ZPl+A/Tf8L2317hUbq5Vw2OAsg== X-Received: by 2002:aa7:9568:0:b0:582:c719:c4c3 with SMTP id x8-20020aa79568000000b00582c719c4c3mr10986633pfq.1.1672961448866; Thu, 05 Jan 2023 15:30:48 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id p5-20020a622905000000b005749f5d9d07sm25612530pfp.99.2023.01.05.15.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 15:30:48 -0800 (PST) From: Kees Cook <keescook@chromium.org> To: "Martin K . Petersen" <martin.petersen@oracle.com> Cc: Kees Cook <keescook@chromium.org>, Dan Williams <dan.j.williams@intel.com>, "Gustavo A. R. Silva" <gustavoars@kernel.org>, kernel test robot <lkp@intel.com>, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] scsi: uapi: Replace 0-length array with flexible array Date: Thu, 5 Jan 2023 15:30:46 -0800 Message-Id: <20230105233042.never.913-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1650; h=from:subject:message-id; bh=q3MZZI/G03tkvHIrcWE8wPRyhsUgVE4YDeJgdc87eVk=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBjt12m2noJQ0jbdpBQb9ezPHSRQ44ShDkRwOksJrbr ejldZpOJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCY7ddpgAKCRCJcvTf3G3AJh+oD/ 47/EsWNMsn/xLs5i5vG8E0HCv/MuHSbxzpgTiOJe+SnzeFfmBYvMd08diHEm/DLW0xoa0eQDvMRHnZ s0qBRnY17u/bnD9+bffPS/n6PEG58eDqA8T1M7foIagxJxgXW8ZoBiMzVn/TmHHl1rQdmORZPdHXVH mjifc2qlU88nvKAadmK8/7Mgo497j1Ad8u4oPGB1Nx3aigCn2p9ea5bzS9jRwXiFrpy7UEOidCPpwj MnK1rSY6OH7H8aY2gd6P+bpJ83mGOlb+U9frd8jOeQAxTqTxzZaCcGmojiKrnqGQ/FDoDYyX6nNtwp 9iOZ6i4qjHumo6BXmLk2ygVOAUw5a/PNHq49NLn2IaVpwdW8v3nEFpchB5Ocm0AQOGrB45zxc7KCqQ 6IIsmogebFOg6K8wZONPGP0uSAvd5GvgdPzfVNHMHVkmv6DChPEYKxT7hv7N16z18OWx9oLwuao2nY 4iQBvOFRUlzPrZuVaqK5L1Hvb3HNwtrIYTbaR3vr/z2l4YzuqeAENVCOVhdAzTV34o0pl08VKZqmji MatpWW+2ROOuUztF3MLTYaKGoALw8EId8q1a4KuljvyHDEfXMuMQkIoHJvrNnTXz/4/T5RqkcnAt5P 05W/xRrDvfN6KIROXRjOn9zrovwj4h6MgGZJtLFE30jHga+2I23SE9CbmNDQ== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754227509408747092?= X-GMAIL-MSGID: =?utf-8?q?1754227509408747092?= |
Series |
scsi: uapi: Replace 0-length array with flexible array
|
|
Commit Message
Kees Cook
Jan. 5, 2023, 11:30 p.m. UTC
Zero-length arrays are deprecated[1]. Replace struct
fc_bsg_host_vendor_reply's "vendor_rsp" 0-length array with a flexible
array. Detected with GCC 13, using -fstrict-flex-arrays=3:
drivers/scsi/qla2xxx/qla_isr.c: In function 'qla25xx_process_bidir_status_iocb.isra':
drivers/scsi/qla2xxx/qla_isr.c:3117:54: warning: array subscript 0 is outside array bounds of '__u32[0]' {aka 'unsigned int[]'} [-Warray-bounds=]
3117 | bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = rval;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from drivers/scsi/qla2xxx/qla_def.h:34,
from drivers/scsi/qla2xxx/qla_isr.c:6:
include/uapi/scsi/scsi_bsg_fc.h:219:15: note: while referencing 'vendor_rsp'
219 | __u32 vendor_rsp[0];
| ^~~~~~~~~~
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
include/uapi/scsi/scsi_bsg_fc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, Jan 05, 2023 at 03:30:46PM -0800, Kees Cook wrote: > Zero-length arrays are deprecated[1]. Replace struct > fc_bsg_host_vendor_reply's "vendor_rsp" 0-length array with a flexible > array. Detected with GCC 13, using -fstrict-flex-arrays=3: > > drivers/scsi/qla2xxx/qla_isr.c: In function 'qla25xx_process_bidir_status_iocb.isra': > drivers/scsi/qla2xxx/qla_isr.c:3117:54: warning: array subscript 0 is outside array bounds of '__u32[0]' {aka 'unsigned int[]'} [-Warray-bounds=] > 3117 | bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = rval; > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ > In file included from drivers/scsi/qla2xxx/qla_def.h:34, > from drivers/scsi/qla2xxx/qla_isr.c:6: > include/uapi/scsi/scsi_bsg_fc.h:219:15: note: while referencing 'vendor_rsp' > 219 | __u32 vendor_rsp[0]; > | ^~~~~~~~~~ > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays > > Cc: Martin K. Petersen <martin.petersen@oracle.com> > Cc: Dan Williams <dan.j.williams@intel.com> > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org> > Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Thanks! -- Gustavo > --- > include/uapi/scsi/scsi_bsg_fc.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/uapi/scsi/scsi_bsg_fc.h b/include/uapi/scsi/scsi_bsg_fc.h > index 7f5930801f72..5e46cf1054af 100644 > --- a/include/uapi/scsi/scsi_bsg_fc.h > +++ b/include/uapi/scsi/scsi_bsg_fc.h > @@ -216,7 +216,7 @@ struct fc_bsg_host_vendor { > */ > struct fc_bsg_host_vendor_reply { > /* start of vendor response area */ > - __u32 vendor_rsp[0]; > + __DECLARE_FLEX_ARRAY(__u32, vendor_rsp); > }; > > > -- > 2.34.1 >
Kees, > Zero-length arrays are deprecated[1]. Replace struct > fc_bsg_host_vendor_reply's "vendor_rsp" 0-length array with a flexible > array. Detected with GCC 13, using -fstrict-flex-arrays=3: Applied to 6.3/scsi-staging, thanks!
On Thu, 05 Jan 2023 15:30:46 -0800, Kees Cook wrote: > Zero-length arrays are deprecated[1]. Replace struct > fc_bsg_host_vendor_reply's "vendor_rsp" 0-length array with a flexible > array. Detected with GCC 13, using -fstrict-flex-arrays=3: > > drivers/scsi/qla2xxx/qla_isr.c: In function 'qla25xx_process_bidir_status_iocb.isra': > drivers/scsi/qla2xxx/qla_isr.c:3117:54: warning: array subscript 0 is outside array bounds of '__u32[0]' {aka 'unsigned int[]'} [-Warray-bounds=] > 3117 | bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = rval; > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ > In file included from drivers/scsi/qla2xxx/qla_def.h:34, > from drivers/scsi/qla2xxx/qla_isr.c:6: > include/uapi/scsi/scsi_bsg_fc.h:219:15: note: while referencing 'vendor_rsp' > 219 | __u32 vendor_rsp[0]; > | ^~~~~~~~~~ > > [...] Applied to 6.3/scsi-queue, thanks! [1/1] scsi: uapi: Replace 0-length array with flexible array https://git.kernel.org/mkp/scsi/c/64b6deadc938
diff --git a/include/uapi/scsi/scsi_bsg_fc.h b/include/uapi/scsi/scsi_bsg_fc.h index 7f5930801f72..5e46cf1054af 100644 --- a/include/uapi/scsi/scsi_bsg_fc.h +++ b/include/uapi/scsi/scsi_bsg_fc.h @@ -216,7 +216,7 @@ struct fc_bsg_host_vendor { */ struct fc_bsg_host_vendor_reply { /* start of vendor response area */ - __u32 vendor_rsp[0]; + __DECLARE_FLEX_ARRAY(__u32, vendor_rsp); };