Skip to contentSkip to conversation

drm/vmwgfx: Replace one-element array with flexible-array member

PATCH In review Gustavo A. R. Silva 3 participants 3 messages Feb 3, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vmwgfx: Replace one-element array with flexible-array member

One-element arrays are deprecated, and we are replacing them with flexible array members instead. So, replace one-element array with flexible-array member in struct vmw_view.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].

This results in no differences in binary output.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_so.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_so.c +1 -1
index 4ea32b01efc0..0f696ccaddc6 100644
@@ -70,7 +70,7 @@ struct vmw_view {
 	unsigned view_id;              /* Immutable */
 	u32 cmd_size;                  /* Immutable */
 	bool committed;                /* Protected by binding_mutex */
-	u32 cmd[1];                    /* Immutable */
+	u32 cmd[];		       /* Immutable */
 };
 
 static int vmw_view_create(struct vmw_resource *res);
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Gustavo A. R. Silva

One-element arrays are deprecated, and we are replacing them with flexible array members instead. So, replace one-element array with flexible-array member in struct vmw_view.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].

Quoted 6 lines

This results in no differences in binary output.

Signature · 1 line
Kees Cook
Reviewed-by on v1 1/1
#2 lore raw
In reply to Gustavo A. R. Silva
Quoted 28 lines · Gustavo A. R. Silva

One-element arrays are deprecated, and we are replacing them with flexible array members instead. So, replace one-element array with flexible-array member in struct vmw_view.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].

This results in no differences in binary output.

Link:
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FKSPP%2Flinux%2Fissues%2F79&data=05%7C01%7Czackr%40vmware.com%7Ca3eb026ab82f44e3b1d708db0585bd84%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638109844250628429%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=I7IzZMu692BHi68sJFTfSonR4OYW1Kd5D6CENIizrsw%3D&reserved=0
Link:
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FKSPP%2Flinux%2Fissues%2F254&data=05%7C01%7Czackr%40vmware.com%7Ca3eb026ab82f44e3b1d708db0585bd84%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638109844250628429%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Hk97x3i6xHOrq09iuDYojySU9H8ulvlArzGXoKrEDtU%3D&reserved=0
Link:
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgcc.gnu.org%2Fpipermail%2Fgcc-patches%2F2022-October%2F602902.html&data=05%7C01%7Czackr%40vmware.com%7Ca3eb026ab82f44e3b1d708db0585bd84%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638109844250628429%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2B3QRmhuEvEOem89Do6hpS3%2B5sFDcuS%2BWWh9yv6triog%3D&reserved=0

---
 drivers/gpu/drm/vmwgfx/vmwgfx_so.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_so.c +0 -0
index 4ea32b01efc0..0f696ccaddc6 100644
@@ -70,7 +70,7 @@ struct vmw_view {
Quoted 8 lines

        unsigned view_id;              /* Immutable */
        u32 cmd_size;                  /* Immutable */
        bool committed;                /* Protected by binding_mutex */ -       u32 cmd[1];                    /* Immutable */
+       u32 cmd[];                     /* Immutable */
 };

 static int vmw_view_create(struct vmw_resource *res);

Will this go in through linux-next directly or do you want me to push it through drm-misc-next?

z