Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1190b3c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "v4l2-compat-ioctl32: Add support for private buffers"

parents 3670eb62 a1d63f0f
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -30,6 +30,13 @@
	get_user(__assign_tmp, from) || put_user(__assign_tmp, to);	\
})

#define convert_in_user(srcptr, dstptr)					\
({									\
	typeof(*srcptr) val;						\
									\
	get_user(val, srcptr) || put_user(val, dstptr);			\
})

static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	long ret = -ENOIOCTLCMD;
@@ -513,6 +520,15 @@ static int get_v4l2_buffer32(struct v4l2_buffer __user *kp,
				   &up->timestamp.tv_usec))
			return -EFAULT;

	if (type == V4L2_BUF_TYPE_PRIVATE) {
		compat_long_t tmp;

		if (get_user(tmp, &up->m.userptr) ||
				put_user((unsigned long) compat_ptr(tmp),
					&kp->m.userptr))
			return -EFAULT;
	}

	if (V4L2_TYPE_IS_MULTIPLANAR(type)) {
		u32 num_planes = length;

@@ -611,6 +627,10 @@ static int put_v4l2_buffer32(struct v4l2_buffer __user *kp,
	    put_user(length, &up->length))
		return -EFAULT;

	if (type == V4L2_BUF_TYPE_PRIVATE)
		if (convert_in_user(&kp->m.userptr, &up->m.userptr))
			return -EFAULT;

	if (V4L2_TYPE_IS_MULTIPLANAR(type)) {
		u32 num_planes = length;

+3 −0
Original line number Diff line number Diff line
@@ -161,6 +161,9 @@ enum v4l2_buf_type {
	 || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT		\
	 || (type) == V4L2_BUF_TYPE_SDR_OUTPUT)

#define V4L2_TYPE_IS_PRIVATE(type)				\
	((type) == V4L2_BUF_TYPE_PRIVATE)

enum v4l2_tuner_type {
	V4L2_TUNER_RADIO	     = 1,
	V4L2_TUNER_ANALOG_TV	     = 2,