Skip to content

Commit 5ac86f0

Browse files
committed
virt: vbox: struct vmmdev_hgcm_pagelist: Replace 1-element array with flexible array
Replace the deprecated[1] use of a 1-element array in struct vmmdev_hgcm_pagelist with a modern flexible array. As this is UAPI, we cannot trivially change the size of the struct, so use a union to retain the old first element's size, but switch "pages" to a flexible array. No binary differences are present after this conversion. Link: KSPP#79 [1] Reviewed-by: Gustavo A. R. Silva <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent bbf3c7f commit 5ac86f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

include/uapi/linux/vbox_vmmdev_types.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@ struct vmmdev_hgcm_pagelist {
282282
__u32 flags; /** VMMDEV_HGCM_F_PARM_*. */
283283
__u16 offset_first_page; /** Data offset in the first page. */
284284
__u16 page_count; /** Number of pages. */
285-
__u64 pages[1]; /** Page addresses. */
285+
union {
286+
__u64 unused; /** Deprecated place-holder for first "pages" entry. */
287+
__DECLARE_FLEX_ARRAY(__u64, pages); /** Page addresses. */
288+
};
286289
};
287290
VMMDEV_ASSERT_SIZE(vmmdev_hgcm_pagelist, 4 + 2 + 2 + 8);
288291

0 commit comments

Comments
 (0)