[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220401075639.2407457-1-lv.ruyi@zte.com.cn>
Date: Fri, 1 Apr 2022 07:56:39 +0000
From: cgel.zte@...il.com
To: hca@...ux.ibm.com, gor@...ux.ibm.com
Cc: agordeev@...ux.ibm.com, borntraeger@...ux.ibm.com,
svens@...ux.ibm.com, lv.ruyi@....com.cn, egorenar@...ux.ibm.com,
oberpar@...ux.ibm.com, linux-s390@...r.kernel.org,
linux-kernel@...r.kernel.org, Zeal Robot <zealci@....com.cn>
Subject: [PATCH] s390: 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/s390/char/sclp_cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index 15971997cfe2..3c87057436d5 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -241,7 +241,7 @@ struct attach_storage_sccb {
u16 :16;
u16 assigned;
u32 :32;
- u32 entries[0];
+ u32 entries[];
} __packed;
static int sclp_attach_storage(u8 id)
--
2.25.1
Powered by blists - more mailing lists