1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/nvme/target
Nathan Chancellor 440e2051c5 nvmet-fc: Remove __counted_by from nvmet_fc_tgt_queue.fod[]
Work for __counted_by on generic pointers in structures (not just
flexible array members) has started landing in Clang 19 (current tip of
tree). During the development of this feature, a restriction was added
to __counted_by to prevent the flexible array member's element type from
including a flexible array member itself such as:

  struct foo {
    int count;
    char buf[];
  };

  struct bar {
    int count;
    struct foo data[] __counted_by(count);
  };

because the size of data cannot be calculated with the standard array
size formula:

  sizeof(struct foo) * count

This restriction was downgraded to a warning but due to CONFIG_WERROR,
it can still break the build. The application of __counted_by on the fod
member of 'struct nvmet_fc_tgt_queue' triggers this restriction,
resulting in:

  drivers/nvme/target/fc.c:151:2: error: 'counted_by' should not be applied to an array with element of unknown size because 'struct nvmet_fc_fcp_iod' is a struct type with a flexible array member. This will be an error in a future compiler version [-Werror,-Wbounds-safety-counted-by-elt-type-unknown-size]
    151 |         struct nvmet_fc_fcp_iod         fod[] __counted_by(sqsize);
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.

Remove this use of __counted_by to fix the warning/error. However,
rather than remove it altogether, leave it commented, as it may be
possible to support this in future compiler releases.

Cc: stable@vger.kernel.org
Closes: https://github.com/ClangBuiltLinux/linux/issues/2027
Fixes: ccd3129aca ("nvmet-fc: Annotate struct nvmet_fc_tgt_queue with __counted_by")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
2024-06-26 10:13:04 -07:00
..
admin-cmd.c nvmet: set maxcmd to be per controller 2024-03-02 15:18:08 -08:00
auth.c nvme updates for Linux 6.10 2024-05-14 09:14:49 -06:00
configfs.c nvmet: make 'tsas' attribute idempotent for RDMA 2024-06-21 08:49:10 -07:00
core.c nvmet: always initialize cqe.result 2024-06-12 11:00:08 -07:00
discovery.c nvmet: set maxcmd to be per controller 2024-03-02 15:18:08 -08:00
fabrics-cmd-auth.c nvmet: always initialize cqe.result 2024-06-12 11:00:08 -07:00
fabrics-cmd.c nvmet: always initialize cqe.result 2024-06-12 11:00:08 -07:00
fc.c nvmet-fc: Remove __counted_by from nvmet_fc_tgt_queue.fod[] 2024-06-26 10:13:04 -07:00
fcloop.c nvme: fcloop: make fcloop_class constant 2024-03-05 07:56:21 -08:00
io-cmd-bdev.c nvme: port block device access to file 2024-02-25 12:05:24 +01:00
io-cmd-file.c nvmet: use bvec_set_page to initialize bvecs 2023-02-03 08:20:55 -07:00
Kconfig nvme: improve NVME_HOST_AUTH and NVME_TARGET_AUTH config descriptions 2023-12-04 08:39:03 -08:00
loop.c nvme: use ctrl state accessor 2024-01-29 07:02:50 -08:00
Makefile nvmet: implement basic In-Band Authentication 2022-08-02 17:14:49 -06:00
nvmet.h nvme updates for Linux 6.10 2024-05-14 09:14:49 -06:00
passthru.c nvmet-passthru: propagate status from id override functions 2024-06-12 11:00:08 -07:00
rdma.c nvme updates for Linux 6.10 2024-05-14 09:14:49 -06:00
tcp.c nvmet-tcp: fix possible memory leak when tearing down a controller 2024-05-01 02:58:42 -07:00
trace.c nvmet: add tracing of zns commands 2024-03-08 06:58:20 -08:00
trace.h nvme: trace: avoid memcpy overflow warning 2024-01-05 13:16:18 -08:00
zns.c nvmet: zns: Do not reference the gendisk conv_zones_bitmap 2024-04-17 08:44:03 -06:00