<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
please discard this one, I didn't notice the v1 version had been committed. please use the incremental fix instead (<span style="font-weight: 600;">[PATCH VZ10] fs/fuse kio: move struct krpc_completion to the end of struct krpc_req</span>)</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Liu Kui <kui.liu@virtuozzo.com><br>
<b>Sent:</b> 18 May 2026 12:20<br>
<b>To:</b> devel@openvz.org <devel@openvz.org><br>
<b>Cc:</b> Alexey Kuznetsov <kuznet@virtuozzo.com>; Andrey Zaitsev <azaitsev@virtuozzo.com>; Konstantin Khorenko <khorenko@virtuozzo.com>; Kui Liu <kui.liu@virtuozzo.com><br>
<b>Subject:</b> [PATCH VZ10 v2] fs/fuse kio: replace zero-length array with flexible array syntax</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">With FORTIFY_SOURCE, memcpy to a zero-length array field is flagged<br>
as field-spanning, causing kernel warning. Switch to the C99 flexible<br>
array [] syntax to fix this.<br>
<br>
Changes:<br>
v1:<br>
- _data_buf[0] -> _data_buf[] in struct krpc_completion<br>
- sync_resp[0] -> sync_resp[] in struct pcs_cs_iohdr<br>
- nodes[0] -> nodes[] in struct pcs_cs_map_prop<br>
- cs[0] -> cs[] in struct pcs_cs_list<br>
- cs[0] -> cs[] in struct pcs_ioc_getmap<br>
<br>
v2:<br>
- move struct krpc_completion to the end of struct krpc_req<br>
<br>
Link: <a href="https://virtuozzo.atlassian.net/browse/VSTOR-130548">https://virtuozzo.atlassian.net/browse/VSTOR-130548</a><br>
<br>
Signed-off-by: Liu Kui <kui.liu@virtuozzo.com><br>
---<br>
fs/fuse/kio/pcs/pcs_cs_prot.h | 4 ++--<br>
fs/fuse/kio/pcs/pcs_ioctl.h | 2 +-<br>
fs/fuse/kio/pcs/pcs_krpc.h | 6 +++---<br>
fs/fuse/kio/pcs/pcs_map.h | 2 +-<br>
4 files changed, 7 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/fs/fuse/kio/pcs/pcs_cs_prot.h b/fs/fuse/kio/pcs/pcs_cs_prot.h<br>
index c72066de7be4..c524d28b551e 100644<br>
--- a/fs/fuse/kio/pcs/pcs_cs_prot.h<br>
+++ b/fs/fuse/kio/pcs/pcs_cs_prot.h<br>
@@ -79,7 +79,7 @@ struct pcs_cs_iohdr {<br>
u32 fiemap_count; /* Used only in FIEMAP request, limit on number of extents to return */<br>
};<br>
struct pcs_cs_sync_data sync; /* Filled in all requests and responses */<br>
- struct pcs_cs_sync_resp sync_resp[0]; /* Used only in response to write/sync */<br>
+ struct pcs_cs_sync_resp sync_resp[]; /* Used only in response to write/sync */<br>
} __attribute__((aligned(8)));<br>
<br>
static inline int pcs_cs_use_aligned_io(u32 storage_version)<br>
@@ -171,7 +171,7 @@ struct pcs_cs_map_prop {<br>
u16 chain_nodes;<br>
u16 reserved;<br>
u32 nnodes;<br>
- struct pcs_cs_node_desc nodes[0];<br>
+ struct pcs_cs_node_desc nodes[];<br>
} __attribute__((aligned(8)));<br>
<br>
#define CS_OBJ_UNKNOWN -1<br>
diff --git a/fs/fuse/kio/pcs/pcs_ioctl.h b/fs/fuse/kio/pcs/pcs_ioctl.h<br>
index fb22cf8a01b0..07a87d6507f3 100644<br>
--- a/fs/fuse/kio/pcs/pcs_ioctl.h<br>
+++ b/fs/fuse/kio/pcs/pcs_ioctl.h<br>
@@ -74,7 +74,7 @@ struct pcs_ioc_getmap<br>
/* TODO: cs array is only for OUT ? */<br>
u32 cs_cnt; /* The number of CS (including root) entries that follows */<br>
u32 cs_max; /* Max number of CS (including root) entries requested */<br>
- struct pcs_cs_info cs[0]; /* Array of CS including root */<br>
+ struct pcs_cs_info cs[]; /* Array of CS including root */<br>
};<br>
<br>
#define PCS_IOC_NOCSUMONREAD _IOW('V',3,u32)<br>
diff --git a/fs/fuse/kio/pcs/pcs_krpc.h b/fs/fuse/kio/pcs/pcs_krpc.h<br>
index 6a090ef66185..92dae58ef43b 100644<br>
--- a/fs/fuse/kio/pcs/pcs_krpc.h<br>
+++ b/fs/fuse/kio/pcs/pcs_krpc.h<br>
@@ -99,7 +99,7 @@ struct krpc_completion {<br>
<br>
void *private;<br>
int data_len;<br>
- u8 _data_buf[0];<br>
+ u8 _data_buf[];<br>
};<br>
<br>
#define KRPC_MAX_DATA_PAGES 256<br>
@@ -129,11 +129,11 @@ struct krpc_req {<br>
int nr_data_bvecs;<br>
struct bio_vec data_bvecs[KRPC_MAX_DATA_PAGES];<br>
<br>
- struct krpc_completion completion;<br>
-<br>
u32 gen;<br>
struct llist_node llist_link;<br>
struct pcs_krpc_ioc_sendmsg iocmsg;<br>
+<br>
+ struct krpc_completion completion;<br>
};<br>
<br>
static inline u32 pcs_krpc_msg_size(u32 size, u8 flags)<br>
diff --git a/fs/fuse/kio/pcs/pcs_map.h b/fs/fuse/kio/pcs/pcs_map.h<br>
index bf8a0e7177d0..788a8cb16d8e 100644<br>
--- a/fs/fuse/kio/pcs/pcs_map.h<br>
+++ b/fs/fuse/kio/pcs/pcs_map.h<br>
@@ -127,7 +127,7 @@ struct pcs_cs_list<br>
int write_timeout;<br>
int nsrv;<br>
PCS_MAP_VERSION_T version; /* version inherented from map */<br>
- struct pcs_cs_record cs[0];<br>
+ struct pcs_cs_record cs[];<br>
};<br>
<br>
/* TODO, LOCKING!!!!!<br>
-- <br>
2.39.5 (Apple Git-154)<br>
<br>
</div>
</span></font></div>
</body>
</html>