[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220401075537.2407376-1-lv.ruyi@zte.com.cn>
Date: Fri, 1 Apr 2022 07:55:37 +0000
From: cgel.zte@...il.com
To: sudeep.holla@....com
Cc: cristian.marussi@....com, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Lv Ruyi <lv.ruyi@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: [PATCH] firmware: arm_scmi: Replace zero-length array with flexible-array member
From: Lv Ruyi <lv.ruyi@....com.cn>
There is a regular need in the kernel to provide a way to declare
having a dynamically sized set of trailing elements in a structure.
Kernel code should always use “flexible array members”[1] for these
cases. The older style of one-element or zero-length arrays should
no longer be used[2].
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@....com.cn>
---
drivers/firmware/arm_scmi/clock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c
index cf6fed6dec77..d753c040b6e8 100644
--- a/drivers/firmware/arm_scmi/clock.c
+++ b/drivers/firmware/arm_scmi/clock.c
@@ -49,7 +49,7 @@ struct scmi_msg_resp_clock_describe_rates {
struct {
__le32 value_low;
__le32 value_high;
- } rate[0];
+ } rate[];
#define RATE_TO_U64(X) \
({ \
typeof(X) x = (X); \
--
2.25.1
Powered by blists - more mailing lists