Revert "drm: Use a flexible array member for blob property data"
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 23 Feb 2018 19:25:01 +0000 (21:25 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 16 Mar 2018 13:44:01 +0000 (15:44 +0200)
Using a flexible array for the blob data was a mistake by me. It
forces all users of the blob data to cast blob->data to something
else. void* is clearly superior so let's go back to the original
scheme.

Not a clean revert as the code has moved.

This reverts commit d63f5e6bf6f2a1573ea39c9937cdf5ab0b3a4b77.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180223192506.29992-1-ville.syrjala@linux.intel.com
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_property.c
include/drm/drm_property.h

index 6ac6ee41a6a36ec28c02e2e27c214f5652a02b66..8f4672daac7fa3fb402ed6d7c69e3130804b81fd 100644 (file)
@@ -567,6 +567,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
        /* This must be explicitly initialised, so we can safely call list_del
         * on it in the removal handler, even if it isn't in a file list. */
        INIT_LIST_HEAD(&blob->head_file);
+       blob->data = (void *)blob + sizeof(*blob);
        blob->length = length;
        blob->dev = dev;
 
index 937757a8a5687a6453d4c36cbb208119c2ce0dad..d1423c7f3c73e4248aa5c845f4f3f5fbb119ebde 100644 (file)
@@ -209,7 +209,7 @@ struct drm_property_blob {
        struct list_head head_global;
        struct list_head head_file;
        size_t length;
-       unsigned char data[];
+       void *data;
 };
 
 struct drm_prop_enum_list {