diff mbox series

xen: update PV-device interface headers

Message ID 20231205115121.11627-1-jgross@suse.com (mailing list archive)
State Accepted
Commit 125c0a646a257fd58de223f2c3e1fe8a99085644
Headers show
Series xen: update PV-device interface headers | expand

Commit Message

Jürgen Groß Dec. 5, 2023, 11:51 a.m. UTC
Update the Xen PV-device interface headers in order to avoid undefined
behavior with flexible arrays being defined with one array element.

Reported-by: Pry Mar <pryorm09@gmail.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 include/xen/interface/io/displif.h | 2 +-
 include/xen/interface/io/ring.h    | 2 +-
 include/xen/interface/io/sndif.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Stefano Stabellini Dec. 5, 2023, 10:37 p.m. UTC | #1
On Tue, 4 Dec 2023, Juergen Gross wrote:
> Update the Xen PV-device interface headers in order to avoid undefined
> behavior with flexible arrays being defined with one array element.
> 
> Reported-by: Pry Mar <pryorm09@gmail.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>

> ---
>  include/xen/interface/io/displif.h | 2 +-
>  include/xen/interface/io/ring.h    | 2 +-
>  include/xen/interface/io/sndif.h   | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/xen/interface/io/displif.h b/include/xen/interface/io/displif.h
> index 18417b017869..60e42d3b760e 100644
> --- a/include/xen/interface/io/displif.h
> +++ b/include/xen/interface/io/displif.h
> @@ -537,7 +537,7 @@ struct xendispl_dbuf_create_req {
>  
>  struct xendispl_page_directory {
>  	grant_ref_t gref_dir_next_page;
> -	grant_ref_t gref[1]; /* Variable length */
> +	grant_ref_t gref[];
>  };
>  
>  /*
> diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h
> index ba4c4274b714..4fef1efcdcab 100644
> --- a/include/xen/interface/io/ring.h
> +++ b/include/xen/interface/io/ring.h
> @@ -95,7 +95,7 @@ struct __name##_sring {                                                 \
>      RING_IDX req_prod, req_event;                                       \
>      RING_IDX rsp_prod, rsp_event;                                       \
>      uint8_t __pad[48];                                                  \
> -    union __name##_sring_entry ring[1]; /* variable-length */           \
> +    union __name##_sring_entry ring[];                                  \
>  };                                                                      \
>                                                                          \
>  /* "Front" end's private variables */                                   \
> diff --git a/include/xen/interface/io/sndif.h b/include/xen/interface/io/sndif.h
> index 445657cdb1de..b818517588b5 100644
> --- a/include/xen/interface/io/sndif.h
> +++ b/include/xen/interface/io/sndif.h
> @@ -659,7 +659,7 @@ struct xensnd_open_req {
>  
>  struct xensnd_page_directory {
>  	grant_ref_t gref_dir_next_page;
> -	grant_ref_t gref[1]; /* Variable length */
> +	grant_ref_t gref[];
>  };
>  
>  /*
> -- 
> 2.35.3
>
diff mbox series

Patch

diff --git a/include/xen/interface/io/displif.h b/include/xen/interface/io/displif.h
index 18417b017869..60e42d3b760e 100644
--- a/include/xen/interface/io/displif.h
+++ b/include/xen/interface/io/displif.h
@@ -537,7 +537,7 @@  struct xendispl_dbuf_create_req {
 
 struct xendispl_page_directory {
 	grant_ref_t gref_dir_next_page;
-	grant_ref_t gref[1]; /* Variable length */
+	grant_ref_t gref[];
 };
 
 /*
diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h
index ba4c4274b714..4fef1efcdcab 100644
--- a/include/xen/interface/io/ring.h
+++ b/include/xen/interface/io/ring.h
@@ -95,7 +95,7 @@  struct __name##_sring {                                                 \
     RING_IDX req_prod, req_event;                                       \
     RING_IDX rsp_prod, rsp_event;                                       \
     uint8_t __pad[48];                                                  \
-    union __name##_sring_entry ring[1]; /* variable-length */           \
+    union __name##_sring_entry ring[];                                  \
 };                                                                      \
                                                                         \
 /* "Front" end's private variables */                                   \
diff --git a/include/xen/interface/io/sndif.h b/include/xen/interface/io/sndif.h
index 445657cdb1de..b818517588b5 100644
--- a/include/xen/interface/io/sndif.h
+++ b/include/xen/interface/io/sndif.h
@@ -659,7 +659,7 @@  struct xensnd_open_req {
 
 struct xensnd_page_directory {
 	grant_ref_t gref_dir_next_page;
-	grant_ref_t gref[1]; /* Variable length */
+	grant_ref_t gref[];
 };
 
 /*