]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
virt: vbox: struct vmmdev_hgcm_pagelist: Replace 1-element array with flexible array
authorKees Cook <kees@kernel.org>
Wed, 10 Jul 2024 23:15:55 +0000 (16:15 -0700)
committerKees Cook <kees@kernel.org>
Thu, 22 Aug 2024 23:56:24 +0000 (16:56 -0700)
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: https://github.com/KSPP/linux/issues/79
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20240710231555.work.406-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
include/uapi/linux/vbox_vmmdev_types.h

index f8a8d6b3c5219d1399dc28d40e0af0fbb4be8d60..6073858d52a2ed7de11e90da0c985b7869f7dfcc 100644 (file)
@@ -282,7 +282,10 @@ struct vmmdev_hgcm_pagelist {
        __u32 flags;             /** VMMDEV_HGCM_F_PARM_*. */
        __u16 offset_first_page; /** Data offset in the first page. */
        __u16 page_count;        /** Number of pages. */
-       __u64 pages[1];          /** Page addresses. */
+       union {
+               __u64 unused;   /** Deprecated place-holder for first "pages" entry. */
+               __DECLARE_FLEX_ARRAY(__u64, pages); /** Page addresses. */
+       };
 };
 VMMDEV_ASSERT_SIZE(vmmdev_hgcm_pagelist, 4 + 2 + 2 + 8);