With FORTIFY_SOURCE, memcpy to a zero-length arrary field is flagged
as field-spanning, causing kernel warning. Switch to the C99 flexible
array [] syntax to fix this.

Changes:
 - _data_buf[0] -> _data_buf[] in struct krpc_completion
 - sync_resp[0] -> sync_resp[] in struct pcs_cs_iohdr
 - nodes[0] -> nodes[] in struct pcs_cs_map_prop
 - cs[0] -> cs[] in struct pcs_cs_list
 - cs[0] -> cs[] in struct pcs_ioc_getmap

Link: https://virtuozzo.atlassian.net/browse/VSTOR-130548

Signed-off-by: Liu Kui <[email protected]>
---
 fs/fuse/kio/pcs/pcs_cs_prot.h | 4 ++--
 fs/fuse/kio/pcs/pcs_ioctl.h   | 2 +-
 fs/fuse/kio/pcs/pcs_krpc.h    | 2 +-
 fs/fuse/kio/pcs/pcs_map.h     | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_cs_prot.h b/fs/fuse/kio/pcs/pcs_cs_prot.h
index c72066de7be4..c524d28b551e 100644
--- a/fs/fuse/kio/pcs/pcs_cs_prot.h
+++ b/fs/fuse/kio/pcs/pcs_cs_prot.h
@@ -79,7 +79,7 @@ struct pcs_cs_iohdr {
                u32                     fiemap_count;   /* Used only in FIEMAP 
request, limit on number of extents to return */
        };
        struct pcs_cs_sync_data sync;           /* Filled in all requests and 
responses */
-       struct pcs_cs_sync_resp sync_resp[0];   /* Used only in response to 
write/sync */
+       struct pcs_cs_sync_resp sync_resp[];    /* Used only in response to 
write/sync */
 } __attribute__((aligned(8)));
 
 static inline int pcs_cs_use_aligned_io(u32 storage_version)
@@ -171,7 +171,7 @@ struct pcs_cs_map_prop {
        u16                     chain_nodes;
        u16                     reserved;
        u32                     nnodes;
-       struct pcs_cs_node_desc nodes[0];
+       struct pcs_cs_node_desc nodes[];
 } __attribute__((aligned(8)));
 
 #define CS_OBJ_UNKNOWN         -1
diff --git a/fs/fuse/kio/pcs/pcs_ioctl.h b/fs/fuse/kio/pcs/pcs_ioctl.h
index fb22cf8a01b0..07a87d6507f3 100644
--- a/fs/fuse/kio/pcs/pcs_ioctl.h
+++ b/fs/fuse/kio/pcs/pcs_ioctl.h
@@ -74,7 +74,7 @@ struct pcs_ioc_getmap
        /* TODO: cs array is only for OUT ? */
        u32                     cs_cnt;         /* The number of CS (including 
root) entries that follows */
        u32                     cs_max;         /* Max number of CS (including 
root) entries requested */
-       struct pcs_cs_info      cs[0];          /* Array of CS including root */
+       struct pcs_cs_info      cs[];           /* Array of CS including root */
 };
 
 #define PCS_IOC_NOCSUMONREAD   _IOW('V',3,u32)
diff --git a/fs/fuse/kio/pcs/pcs_krpc.h b/fs/fuse/kio/pcs/pcs_krpc.h
index 6a090ef66185..d5a7a56d84c8 100644
--- a/fs/fuse/kio/pcs/pcs_krpc.h
+++ b/fs/fuse/kio/pcs/pcs_krpc.h
@@ -99,7 +99,7 @@ struct krpc_completion {
 
        void            *private;
        int                     data_len;
-       u8                      _data_buf[0];
+       u8                      _data_buf[];
 };
 
 #define KRPC_MAX_DATA_PAGES                    256
diff --git a/fs/fuse/kio/pcs/pcs_map.h b/fs/fuse/kio/pcs/pcs_map.h
index bf8a0e7177d0..788a8cb16d8e 100644
--- a/fs/fuse/kio/pcs/pcs_map.h
+++ b/fs/fuse/kio/pcs/pcs_map.h
@@ -127,7 +127,7 @@ struct pcs_cs_list
        int                     write_timeout;
        int                     nsrv;
        PCS_MAP_VERSION_T       version;                /* version inherented 
from map */
-       struct pcs_cs_record    cs[0];
+       struct pcs_cs_record    cs[];
 };
 
 /* TODO, LOCKING!!!!!
-- 
2.39.5 (Apple Git-154)

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to