2022-10-18 10:07:30

by Katrin Jo

[permalink] [raw]
Subject: [PATCH] ublk_drv: use flexible-array member instead of zero-length array

From: Yushan Zhou <[email protected]>

Eliminate the following coccicheck warning:
./drivers/block/ublk_drv.c:127:16-19: WARNING use flexible-array member instead

Signed-off-by: Yushan Zhou <[email protected]>
---
drivers/block/ublk_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 2651bf41dde3..5afce6ffaadf 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -124,7 +124,7 @@ struct ublk_queue {
bool force_abort;
unsigned short nr_io_ready; /* how many ios setup */
struct ublk_device *dev;
- struct ublk_io ios[0];
+ struct ublk_io ios[];
};

#define UBLK_DAEMON_MONITOR_PERIOD (5 * HZ)
--
2.27.0


2022-10-20 01:40:04

by Ming Lei

[permalink] [raw]
Subject: Re: [PATCH] ublk_drv: use flexible-array member instead of zero-length array

On Tue, Oct 18, 2022 at 6:02 PM <[email protected]> wrote:
>
> From: Yushan Zhou <[email protected]>
>
> Eliminate the following coccicheck warning:
> ./drivers/block/ublk_drv.c:127:16-19: WARNING use flexible-array member instead
>
> Signed-off-by: Yushan Zhou <[email protected]>
> ---
> drivers/block/ublk_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
> index 2651bf41dde3..5afce6ffaadf 100644
> --- a/drivers/block/ublk_drv.c
> +++ b/drivers/block/ublk_drv.c
> @@ -124,7 +124,7 @@ struct ublk_queue {
> bool force_abort;
> unsigned short nr_io_ready; /* how many ios setup */
> struct ublk_device *dev;
> - struct ublk_io ios[0];
> + struct ublk_io ios[];
> };
>
> #define UBLK_DAEMON_MONITOR_PERIOD (5 * HZ)

Reviewed-by: Ming Lei <[email protected]>

Thanks,
Ming

2022-10-20 01:41:42

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] ublk_drv: use flexible-array member instead of zero-length array

On Tue, 18 Oct 2022 18:01:32 +0800, [email protected] wrote:
> From: Yushan Zhou <[email protected]>
>
> Eliminate the following coccicheck warning:
> ./drivers/block/ublk_drv.c:127:16-19: WARNING use flexible-array member instead
>
>

Applied, thanks!

[1/1] ublk_drv: use flexible-array member instead of zero-length array
commit: 72495b5ab456ec9f05d587238d1e2fa8e9ea63ec

Best regards,
--
Jens Axboe