Hi Hans,

On Thu, Aug 22, 2013 at 12:14:17PM +0200, Hans Verkuil wrote:
From: Hans Verkuil <hans.verk...@cisco.com>

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 49 +++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index 8f7a6a4..3e5a30f 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -777,6 +777,38 @@ static int put_v4l2_subdev_edid32(struct v4l2_subdev_edid 
*kp, struct v4l2_subde
        return 0;
 }

+struct v4l2_matrix32 {
+       __u32 type;
+       union {
+               __u32 raw[4];
+       } ref;

I sense untested code here.

+       struct v4l2_rect rect;
+       compat_caddr_t matrix;
+       __u32 reserved[12];
+} __attribute__ ((packed));
+
+static int get_v4l2_matrix32(struct v4l2_matrix *kp, struct v4l2_matrix32 
__user *up)
+{
+       u32 tmp;
+
+       if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_matrix32)) ||
+           get_user(kp->type, &up->type) ||
+           copy_from_user(&kp->rect, &up->rect, sizeof(up->rect)) ||
+           get_user(tmp, &up->matrix) ||
+           copy_from_user(kp->reserved, up->reserved, sizeof(kp->reserved)))

Is it useful to copy the reserved fields?

+               return -EFAULT;
+       kp->matrix = compat_ptr(tmp);
+       return 0;
+}

--
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi     XMPP: sai...@retiisi.org.uk
--
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