* [PATCH] firmware: arm_scmi: Replace zero-length array with flexible-array member
@ 2022-04-01 7:55 ` cgel.zte
0 siblings, 0 replies; 4+ messages in thread
From: cgel.zte @ 2022-04-01 7:55 UTC (permalink / raw)
To: sudeep.holla
Cc: cristian.marussi, linux-arm-kernel, linux-kernel, Lv Ruyi, Zeal Robot
From: Lv Ruyi <lv.ruyi@zte.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@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] firmware: arm_scmi: Replace zero-length array with flexible-array member
@ 2022-04-01 7:55 ` cgel.zte
0 siblings, 0 replies; 4+ messages in thread
From: cgel.zte @ 2022-04-01 7:55 UTC (permalink / raw)
To: sudeep.holla
Cc: cristian.marussi, linux-arm-kernel, linux-kernel, Lv Ruyi, Zeal Robot
From: Lv Ruyi <lv.ruyi@zte.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@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] firmware: arm_scmi: Replace zero-length array with flexible-array member
2022-04-01 7:55 ` cgel.zte
@ 2022-04-05 14:32 ` Sudeep Holla
-1 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2022-04-05 14:32 UTC (permalink / raw)
To: cgel.zte
Cc: Sudeep Holla, linux-arm-kernel, Zeal Robot, linux-kernel,
Lv Ruyi, cristian.marussi
On Fri, 1 Apr 2022 07:55:37 +0000, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.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].
>
> [...]
Applied to sudeep.holla/linux (fixes/scmi), thanks!
[1/1] firmware: arm_scmi: Replace zero-length array with flexible-array member
https://git.kernel.org/sudeep.holla/c/f1ad601d1f
--
Regards,
Sudeep
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] firmware: arm_scmi: Replace zero-length array with flexible-array member
@ 2022-04-05 14:32 ` Sudeep Holla
0 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2022-04-05 14:32 UTC (permalink / raw)
To: cgel.zte
Cc: Sudeep Holla, linux-arm-kernel, Zeal Robot, linux-kernel,
Lv Ruyi, cristian.marussi
On Fri, 1 Apr 2022 07:55:37 +0000, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.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].
>
> [...]
Applied to sudeep.holla/linux (fixes/scmi), thanks!
[1/1] firmware: arm_scmi: Replace zero-length array with flexible-array member
https://git.kernel.org/sudeep.holla/c/f1ad601d1f
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-05 20:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01 7:55 [PATCH] firmware: arm_scmi: Replace zero-length array with flexible-array member cgel.zte
2022-04-01 7:55 ` cgel.zte
2022-04-05 14:32 ` Sudeep Holla
2022-04-05 14:32 ` Sudeep Holla
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.