media: media-device.c: zero reserved fields
authorHans Verkuil <hverkuil@xs4all.nl>
Sat, 3 Feb 2018 18:46:05 +0000 (13:46 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 26 Feb 2018 14:46:55 +0000 (09:46 -0500)
MEDIA_IOC_SETUP_LINK didn't zero the reserved field of the media_link_desc
struct. Do so in media_device_setup_link().

MEDIA_IOC_ENUM_LINKS didn't zero the reserved field of the media_links_enum
struct. Do so in media_device_enum_links().

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/media-device.c

index f442444..5d55743 100644 (file)
@@ -190,6 +190,7 @@ static long media_device_enum_links(struct media_device *mdev,
                        ulink_desc++;
                }
        }
+       memset(links->reserved, 0, sizeof(links->reserved));
 
        return 0;
 }
@@ -218,6 +219,8 @@ static long media_device_setup_link(struct media_device *mdev,
        if (link == NULL)
                return -EINVAL;
 
+       memset(linkd->reserved, 0, sizeof(linkd->reserved));
+
        /* Setup the link on both entities. */
        return __media_entity_setup_link(link, linkd->flags);
 }