• Arnd Bergmann's avatar
    media: v4l2: allocate v4l2_clip objects early · 3f65c6f6
    Arnd Bergmann authored
    The v4l2_format based ioctls can have an indirect pointer to an array
    of v4l2_clip structures for overlay mode, depending on the 'type' member.
    There are only five drivers that use the overlay mode and copy the
    data through the __user pointer.
    
    Change the five drivers to use memcpy() instead, and copy the data
    in common code using the check_array_args() helpers. This allows
    for a subsequent patch that use the same mechanism for compat
    ioctl handlers.
    
    Note that there is another pointer for a 'bitmap' that is only
    used in the 'vivid' driver and nowhere else. There is no easy
    way to use the same trick without adding complexity to the
    common code, so this remains a __user pointer.
    
    [hverkuil: fix: CHECK: spaces preferred around that '*' (ctx:VxV)]
    [hverkuil: fix: CHECK: Alignment should match open parenthesis]
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    3f65c6f6
v4l2-ioctl.c 108 KB