On 09/20/2013 04:30 PM, Sakari Ailus wrote:
> Hi Hans,
> 
> On Fri, Aug 23, 2013 at 02:15:30PM +0200, Hans Verkuil wrote:
>> Update of RFCv3 PATCH 03/10 from the "Matrix and Motion Detection support"
>> patch series. This time I've actually tested it, and as a bonus found a
>> bug in the G/S_SUBDEV_EDID32 handling as well.
>>
>> Regards,
>>
>>      Hans
>>
>> [PATCH] v4l2-compat-ioctl32: add g/s_matrix support.
>>
>> Also fix a copy_to_user bug in put_v4l2_subdev_edid32(): the user and kernel
>> pointers were used the wrong way around.
>>
>> Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
>> ---
>>  drivers/media/v4l2-core/v4l2-compat-ioctl32.c |   50 
>> ++++++++++++++++++++++++-
>>  1 file changed, 49 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
>> b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
>> index 8f7a6a4..8fb3e86 100644
>> --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
>> +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
>> @@ -772,11 +772,40 @@ static int put_v4l2_subdev_edid32(struct 
>> v4l2_subdev_edid *kp, struct v4l2_subde
>>              put_user(kp->start_block, &up->start_block) ||
>>              put_user(kp->blocks, &up->blocks) ||
>>              put_user(tmp, &up->edid) ||
>> -            copy_to_user(kp->reserved, up->reserved, sizeof(kp->reserved)))
>> +            copy_to_user(up->reserved, kp->reserved, sizeof(kp->reserved)))
> 
> This warrants to be a separate patch. Is this bug present in released kenrel
> versions?

Yes, but this has never been used on 64-bit systems. I didn't think it was 
important
enough to backport.

But perhaps I should do this anyway...

        Hans

> 
>>                      return -EFAULT;
>>      return 0;
>>  }
>>  
>> +struct v4l2_matrix32 {
>> +    __u32 type;
>> +    struct v4l2_rect rect;
>> +    compat_caddr_t matrix;
>> +    __u32 reserved[16];
>> +} __attribute__ ((packed));
>> +
>> +static int get_v4l2_matrix32(struct v4l2_matrix *kp, struct v4l2_matrix32 
>> __user *up)
> 
> How about splitting the lines that go over 80?
> 
> Acked-by: Sakari Ailus <sakari.ai...@iki.fi>
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to