From owner-svn-src-head@FreeBSD.ORG Mon May 3 14:19:59 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7D897106566B; Mon, 3 May 2010 14:19:59 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 6D4788FC18; Mon, 3 May 2010 14:19:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43EJx49003479; Mon, 3 May 2010 14:19:59 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43EJwgV003478; Mon, 3 May 2010 14:19:58 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <201005031419.o43EJwgV003478@svn.freebsd.org> From: Alexander Leidinger Date: Mon, 3 May 2010 14:19:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207569 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 14:19:59 -0000 Author: netchild Date: Mon May 3 14:19:58 2010 New Revision: 207569 URL: http://svn.freebsd.org/changeset/base/207569 Log: - #ifdef out the cliplist part, skype seems like using an uninitialized variable and can cause problems, without the cliplist handling it works without problems - improve the cliplist error handling - fix VIDIOCGTUNER and VIDIOCSMICROCODE (still no hardware available to test) Submitted by: J.R. Oldroyd X-MFC after: soon (together with all the v4l stuff) Modified: head/sys/compat/linux/linux_ioctl.c Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Mon May 3 12:43:17 2010 (r207568) +++ head/sys/compat/linux/linux_ioctl.c Mon May 3 14:19:58 2010 (r207569) @@ -2628,6 +2628,7 @@ bsd_to_linux_v4l_tuner(struct video_tune return (0); } +#ifdef COMPAT_LINUX_V4L_CLIPLIST static int linux_to_bsd_v4l_clip(struct l_video_clip *lvc, struct video_clip *vc) { @@ -2638,6 +2639,7 @@ linux_to_bsd_v4l_clip(struct l_video_cli vc->next = PTRIN(lvc->next); /* possible pointer size conversion */ return (0); } +#endif static int linux_to_bsd_v4l_window(struct l_video_window *lvw, struct video_window *vw) @@ -2698,6 +2700,7 @@ linux_to_bsd_v4l_code(struct l_video_cod return (0); } +#ifdef COMPAT_LINUX_V4L_CLIPLIST static int linux_v4l_clip_copy(void *lvc, struct video_clip **ppvc) { @@ -2772,15 +2775,18 @@ linux_v4l_cliplist_copy(struct l_video_w * example of cliplist use. */ plvc = PTRIN(lvw->clips); + vw->clips = NULL; ppvc = &(vw->clips); while (clipcount-- > 0) { - if (plvc == 0) + if (plvc == 0) { error = EFAULT; - if (!error) - error = linux_v4l_clip_copy(plvc, ppvc); - if (error) { - linux_v4l_cliplist_free(vw); break; + } else { + error = linux_v4l_clip_copy(plvc, ppvc); + if (error) { + linux_v4l_cliplist_free(vw); + break; + } } ppvc = &((*ppvc)->next); plvc = PTRIN(((struct l_video_clip *) plvc)->next); @@ -2795,6 +2801,7 @@ linux_v4l_cliplist_copy(struct l_video_w } return (error); } +#endif static int linux_ioctl_v4l(struct thread *td, struct linux_ioctl_args *args) @@ -2818,6 +2825,12 @@ linux_ioctl_v4l(struct thread *td, struc case LINUX_VIDIOCGTUNER: if ((error = fget(td, args->fd, &fp)) != 0) return (error); + error = copyin((void *) args->arg, &l_vtun, sizeof(l_vtun)); + if (error) { + fdrop(fp, td); + return (error); + } + linux_to_bsd_v4l_tuner(&l_vtun, &vtun); error = fo_ioctl(fp, VIDIOCGTUNER, &vtun, td->td_ucred, td); if (!error) { bsd_to_linux_v4l_tuner(&vtun, &l_vtun); @@ -2836,7 +2849,7 @@ linux_ioctl_v4l(struct thread *td, struc return (error); } linux_to_bsd_v4l_tuner(&l_vtun, &vtun); - error = fo_ioctl(fp, VIDIOCSMICROCODE, &vtun, td->td_ucred, td); + error = fo_ioctl(fp, VIDIOCSTUNER, &vtun, td->td_ucred, td); fdrop(fp, td); return (error); @@ -2865,14 +2878,18 @@ linux_ioctl_v4l(struct thread *td, struc return (error); } linux_to_bsd_v4l_window(&l_vwin, &vwin); +#ifdef COMPAT_LINUX_V4L_CLIPLIST error = linux_v4l_cliplist_copy(&l_vwin, &vwin); if (error) { fdrop(fp, td); return (error); } +#endif error = fo_ioctl(fp, VIDIOCSWIN, &vwin, td->td_ucred, td); fdrop(fp, td); +#ifdef COMPAT_LINUX_V4L_CLIPLIST linux_v4l_cliplist_free(&vwin); +#endif return (error); case LINUX_VIDIOCGFBUF: @@ -2924,7 +2941,7 @@ linux_ioctl_v4l(struct thread *td, struc return (error); } linux_to_bsd_v4l_code(&l_vcode, &vcode); - error = fo_ioctl(fp, VIDIOCSTUNER, &vcode, td->td_ucred, td); + error = fo_ioctl(fp, VIDIOCSMICROCODE, &vcode, td->td_ucred, td); fdrop(fp, td); return (error);