firmware: arm_scmi: Replace zero-length array with flexible-array member
authorLv Ruyi <lv.ruyi@zte.com.cn>
Fri, 1 Apr 2022 07:55:37 +0000 (07:55 +0000)
committerSudeep Holla <sudeep.holla@arm.com>
Mon, 4 Apr 2022 22:06:37 +0000 (23:06 +0100)
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

Link: https://lore.kernel.org/r/20220401075537.2407376-1-lv.ruyi@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/clock.c

index ef6431c6eb1ce78a9e51f3258924ff35a509071e..45600acc0f455e55be81b75ec0cbebe3fc9a119e 100644 (file)
@@ -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);      \