From patchwork Tue Apr 17 14:21:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10345221 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7C04160542 for ; Tue, 17 Apr 2018 14:21:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63F7A2833E for ; Tue, 17 Apr 2018 14:21:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57D80283E8; Tue, 17 Apr 2018 14:21:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BCB82833E for ; Tue, 17 Apr 2018 14:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752769AbeDQOVz (ORCPT ); Tue, 17 Apr 2018 10:21:55 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58388 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751927AbeDQOVy (ORCPT ); Tue, 17 Apr 2018 10:21:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=rF1MPz7CAhJPgVstB1aw2Q6hIarBQMeUlu/vshmslt4=; b=cQ4MGwfKTe1Oh02YMPvWYx1H7 VRpVB8l6pxRULEfEIg9b5I/NO3XGvs9r5jmf2puxIA/Ul+XRZS3sLV24EeUDbJs5Pwgxg4BzbTJdD 9erKA/rCngREO7fJEGvSyQ6eYZRT8VGYZ/+CIHJQEwFRSc1ONrFCnGUDGyeebvNV1z4GKV/HS5wKU dRDTUgxC42wZBzOqV4HeKkAyducR6go652D3YryDmZZD84C3PuI6ccFVPbOH8VaMlTnJPs/qodAh2 NgBZe4SAH+doz8YsUGLbM0nXyjHUS8UCsmMGOn48qwE2Kq305/JmoBGKP3dDbDKmEZAlUfxPFwifS RC3MTrAEg==; Received: from [201.86.164.1] (helo=vento.lan) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8RUX-0003yR-1e; Tue, 17 Apr 2018 14:21:53 +0000 Date: Tue, 17 Apr 2018 11:21:49 -0300 From: Mauro Carvalho Chehab To: Hans Verkuil Cc: Linux Media Mailing List , Sakari Ailus , Daniel Mentz , Laurent Pinchart Subject: Re: [PATCH 4/5] media: v4l2-compat-ioctl32: fix several __user annotations Message-ID: <20180417112149.33e0ba31@vento.lan> In-Reply-To: <20180417105824.6abafda9@vento.lan> References: <510d0652872c612db21be8b846755f80e3cc4588.1523960171.git.mchehab@s-opensource.com> <20180417075358.61a878c8@vento.lan> <20180417100131.3add7f67@vento.lan> <20180417101009.71d98c63@vento.lan> <20180417105824.6abafda9@vento.lan> X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Em Tue, 17 Apr 2018 10:58:24 -0300 Mauro Carvalho Chehab escreveu: > Em Tue, 17 Apr 2018 10:10:09 -0300 > Mauro Carvalho Chehab escreveu: > > > Em Tue, 17 Apr 2018 10:01:31 -0300 > > Mauro Carvalho Chehab escreveu: > > > > > > >> ->blocks is a u32, so this should be a u32 cast as well. > > > > > > > > Be aware that the unsigned char * cast is actually a bug: it will clamp the > > > > u32 'blocks' value to a u8. > > > > > > > > Regards, > > > > > > > > Hans > > > > > > What about this approach (code untested)? > > > > Even better: > > > > [PATCH] media: v4l2-compat-ioctl32: simplify casts > > > > Making the cast right for get_user/put_user is not trivial, as > > it needs to ensure that the types are the correct ones. > > > > Improve it by using macros. > > > > PS.: Patch untested > > Tested with: > > $ sudo modprobe vivid no_error_inj=1 > $ v4l2-compliance-32bits -a -s10 >32bits && v4l2-compliance-64bits -a -s10 > 64bits && diff 32bits 64bits As I was not running the very latest version of v4l2-compliance, I applied this patch to both 32 and 64 bit versions of it: https://patchwork.linuxtv.org/patch/48746/ Rebuilt and re-run. Those are the results: $ v4l2-compliance-32bits -a -s10 >32bits && v4l2-compliance-64bits -a -s10 > 64bits && diff -U0 32bits 64bits Hans, Please check this patch and apply if you think it is worth: https://patchwork.linuxtv.org/patch/48746/ > > 32 bits version results: > > v4l2-compliance SHA : bc71e4a67c6fbc5940062843bc41e7c8679634ce > > Compliance test for device /dev/video0: > > Driver Info: > Driver name : vivid > Card type : vivid > Bus info : platform:vivid-000 > Driver version : 4.17.0 > Capabilities : 0x853f0df7 > Video Capture > Video Output > Video Overlay > VBI Capture > VBI Output > Sliced VBI Capture > Sliced VBI Output > RDS Capture > RDS Output > SDR Capture > Tuner > HW Frequency Seek > Modulator > Audio > Radio > Read/Write > Streaming > Extended Pix Format > Device Capabilities > Device Caps : 0x05230005 > Video Capture > Video Overlay > Tuner > Audio > Read/Write > Streaming > Extended Pix Format > > Required ioctls: > test VIDIOC_QUERYCAP: OK > > Allow for multiple opens: > test second /dev/video0 open: OK > test VIDIOC_QUERYCAP: OK > test VIDIOC_G/S_PRIORITY: OK > test for unlimited opens: OK > > Debug ioctls: > test VIDIOC_DBG_G/S_REGISTER: OK > test VIDIOC_LOG_STATUS: OK > > Input ioctls: > test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK > test VIDIOC_G/S_FREQUENCY: OK > test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) > test VIDIOC_ENUMAUDIO: OK > test VIDIOC_G/S/ENUMINPUT: OK > test VIDIOC_G/S_AUDIO: OK > Inputs: 4 Audio Inputs: 2 Tuners: 1 > > Output ioctls: > test VIDIOC_G/S_MODULATOR: OK (Not Supported) > test VIDIOC_G/S_FREQUENCY: OK > test VIDIOC_ENUMAUDOUT: OK (Not Supported) > test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) > test VIDIOC_G/S_AUDOUT: OK (Not Supported) > Outputs: 0 Audio Outputs: 0 Modulators: 0 > > Input/Output configuration ioctls: > test VIDIOC_ENUM/G/S/QUERY_STD: OK > test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK > test VIDIOC_DV_TIMINGS_CAP: OK > test VIDIOC_G/S_EDID: OK > > Control ioctls (Input 0): > test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK > test VIDIOC_QUERYCTRL: OK > test VIDIOC_G/S_CTRL: OK > test VIDIOC_G/S/TRY_EXT_CTRLS: OK > test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK > test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) > Standard Controls: 15 Private Controls: 39 > > Format ioctls (Input 0): > test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK > test VIDIOC_G/S_PARM: OK > test VIDIOC_G_FBUF: OK > test VIDIOC_G_FMT: OK > test VIDIOC_TRY_FMT: OK > test VIDIOC_S_FMT: OK > test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) > test Cropping: OK (Not Supported) > test Composing: OK (Not Supported) > test Scaling: OK (Not Supported) > > Codec ioctls (Input 0): > test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) > test VIDIOC_G_ENC_INDEX: OK (Not Supported) > test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) > > Buffer ioctls (Input 0): > test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK > test VIDIOC_EXPBUF: OK > > Control ioctls (Input 1): > test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK > test VIDIOC_QUERYCTRL: OK > test VIDIOC_G/S_CTRL: OK > test VIDIOC_G/S/TRY_EXT_CTRLS: OK > test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK > test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) > Standard Controls: 15 Private Controls: 39 > > Format ioctls (Input 1): > test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK > test VIDIOC_G/S_PARM: OK > test VIDIOC_G_FBUF: OK > test VIDIOC_G_FMT: OK > test VIDIOC_TRY_FMT: OK > test VIDIOC_S_FMT: OK > test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) > test Cropping: OK > test Composing: OK > test Scaling: OK > > Codec ioctls (Input 1): > test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) > test VIDIOC_G_ENC_INDEX: OK (Not Supported) > test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) > > Buffer ioctls (Input 1): > test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK > test VIDIOC_EXPBUF: OK > > Control ioctls (Input 2): > test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK > test VIDIOC_QUERYCTRL: OK > test VIDIOC_G/S_CTRL: OK > test VIDIOC_G/S/TRY_EXT_CTRLS: OK > test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK > test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) > Standard Controls: 15 Private Controls: 39 > > Format ioctls (Input 2): > test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK > test VIDIOC_G/S_PARM: OK > test VIDIOC_G_FBUF: OK > test VIDIOC_G_FMT: OK > test VIDIOC_TRY_FMT: OK > test VIDIOC_S_FMT: OK > test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) > test Cropping: OK > test Composing: OK > test Scaling: OK > > Codec ioctls (Input 2): > test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) > test VIDIOC_G_ENC_INDEX: OK (Not Supported) > test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) > > Buffer ioctls (Input 2): > test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK > test VIDIOC_EXPBUF: OK > > Control ioctls (Input 3): > test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK > test VIDIOC_QUERYCTRL: OK > test VIDIOC_G/S_CTRL: OK > test VIDIOC_G/S/TRY_EXT_CTRLS: OK > warn: v4l2-test-controls.cpp(825): V4L2_CID_DV_RX_POWER_PRESENT not found for input 3 > test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK > test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) > Standard Controls: 15 Private Controls: 39 > > Format ioctls (Input 3): > test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK > test VIDIOC_G/S_PARM: OK > test VIDIOC_G_FBUF: OK > test VIDIOC_G_FMT: OK > test VIDIOC_TRY_FMT: OK > test VIDIOC_S_FMT: OK > test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) > test Cropping: OK > test Composing: OK > test Scaling: OK > > Codec ioctls (Input 3): > test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) > test VIDIOC_G_ENC_INDEX: OK (Not Supported) > test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) > > Buffer ioctls (Input 3): > test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK > test VIDIOC_EXPBUF: OK > > Test input 0: > > Streaming ioctls: > test read/write: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test MMAP: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test USERPTR: OK > test DMABUF: Cannot test, specify --expbuf-device > > Test input 1: > > Streaming ioctls: > test read/write: OK > warn: v4l2-test-buffers.cpp(235): V4L2_BUF_FLAG_TIMECODE was used! > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test MMAP: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test USERPTR: OK > test DMABUF: Cannot test, specify --expbuf-device > > Test input 2: > > Streaming ioctls: > test read/write: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test MMAP: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test USERPTR: OK > test DMABUF: Cannot test, specify --expbuf-device > > Test input 3: > > Streaming ioctls: > test read/write: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test MMAP: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test USERPTR: OK > test DMABUF: Cannot test, specify --expbuf-device > > Total: 118, Succeeded: 118, Failed: 0, Warnings: 2 > > 64 bits result: > > > v4l2-compliance SHA : bc71e4a67c6fbc5940062843bc41e7c8679634ce > > Compliance test for device /dev/video0: > > Driver Info: > Driver name : vivid > Card type : vivid > Bus info : platform:vivid-000 > Driver version : 4.17.0 > Capabilities : 0x853f0df7 > Video Capture > Video Output > Video Overlay > VBI Capture > VBI Output > Sliced VBI Capture > Sliced VBI Output > RDS Capture > RDS Output > SDR Capture > Tuner > HW Frequency Seek > Modulator > Audio > Radio > Read/Write > Streaming > Extended Pix Format > Device Capabilities > Device Caps : 0x05230005 > Video Capture > Video Overlay > Tuner > Audio > Read/Write > Streaming > Extended Pix Format > > Required ioctls: > test VIDIOC_QUERYCAP: OK > > Allow for multiple opens: > test second /dev/video0 open: OK > test VIDIOC_QUERYCAP: OK > test VIDIOC_G/S_PRIORITY: OK > test for unlimited opens: OK > > Debug ioctls: > test VIDIOC_DBG_G/S_REGISTER: OK > test VIDIOC_LOG_STATUS: OK > > Input ioctls: > test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK > test VIDIOC_G/S_FREQUENCY: OK > test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) > test VIDIOC_ENUMAUDIO: OK > test VIDIOC_G/S/ENUMINPUT: OK > test VIDIOC_G/S_AUDIO: OK > Inputs: 4 Audio Inputs: 2 Tuners: 1 > > Output ioctls: > test VIDIOC_G/S_MODULATOR: OK (Not Supported) > test VIDIOC_G/S_FREQUENCY: OK > test VIDIOC_ENUMAUDOUT: OK (Not Supported) > test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) > test VIDIOC_G/S_AUDOUT: OK (Not Supported) > Outputs: 0 Audio Outputs: 0 Modulators: 0 > > Input/Output configuration ioctls: > test VIDIOC_ENUM/G/S/QUERY_STD: OK > test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK > test VIDIOC_DV_TIMINGS_CAP: OK > test VIDIOC_G/S_EDID: OK > > Control ioctls (Input 0): > test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK > test VIDIOC_QUERYCTRL: OK > test VIDIOC_G/S_CTRL: OK > test VIDIOC_G/S/TRY_EXT_CTRLS: OK > test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK > test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) > Standard Controls: 15 Private Controls: 39 > > Format ioctls (Input 0): > test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK > test VIDIOC_G/S_PARM: OK > test VIDIOC_G_FBUF: OK > test VIDIOC_G_FMT: OK > test VIDIOC_TRY_FMT: OK > test VIDIOC_S_FMT: OK > test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) > test Cropping: OK (Not Supported) > test Composing: OK (Not Supported) > test Scaling: OK (Not Supported) > > Codec ioctls (Input 0): > test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) > test VIDIOC_G_ENC_INDEX: OK (Not Supported) > test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) > > Buffer ioctls (Input 0): > test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK > test VIDIOC_EXPBUF: OK > > Control ioctls (Input 1): > test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK > test VIDIOC_QUERYCTRL: OK > test VIDIOC_G/S_CTRL: OK > test VIDIOC_G/S/TRY_EXT_CTRLS: OK > test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK > test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) > Standard Controls: 15 Private Controls: 39 > > Format ioctls (Input 1): > test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK > test VIDIOC_G/S_PARM: OK > test VIDIOC_G_FBUF: OK > test VIDIOC_G_FMT: OK > test VIDIOC_TRY_FMT: OK > test VIDIOC_S_FMT: OK > test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) > test Cropping: OK > test Composing: OK > test Scaling: OK > > Codec ioctls (Input 1): > test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) > test VIDIOC_G_ENC_INDEX: OK (Not Supported) > test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) > > Buffer ioctls (Input 1): > test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK > test VIDIOC_EXPBUF: OK > > Control ioctls (Input 2): > test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK > test VIDIOC_QUERYCTRL: OK > test VIDIOC_G/S_CTRL: OK > test VIDIOC_G/S/TRY_EXT_CTRLS: OK > test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK > test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) > Standard Controls: 15 Private Controls: 39 > > Format ioctls (Input 2): > test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK > test VIDIOC_G/S_PARM: OK > test VIDIOC_G_FBUF: OK > test VIDIOC_G_FMT: OK > test VIDIOC_TRY_FMT: OK > test VIDIOC_S_FMT: OK > test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) > test Cropping: OK > test Composing: OK > test Scaling: OK > > Codec ioctls (Input 2): > test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) > test VIDIOC_G_ENC_INDEX: OK (Not Supported) > test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) > > Buffer ioctls (Input 2): > test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK > test VIDIOC_EXPBUF: OK > > Control ioctls (Input 3): > test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK > test VIDIOC_QUERYCTRL: OK > test VIDIOC_G/S_CTRL: OK > test VIDIOC_G/S/TRY_EXT_CTRLS: OK > warn: v4l2-test-controls.cpp(825): V4L2_CID_DV_RX_POWER_PRESENT not found for input 3 > test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK > test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) > Standard Controls: 15 Private Controls: 39 > > Format ioctls (Input 3): > test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK > test VIDIOC_G/S_PARM: OK > test VIDIOC_G_FBUF: OK > test VIDIOC_G_FMT: OK > test VIDIOC_TRY_FMT: OK > test VIDIOC_S_FMT: OK > test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) > test Cropping: OK > test Composing: OK > test Scaling: OK > > Codec ioctls (Input 3): > test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) > test VIDIOC_G_ENC_INDEX: OK (Not Supported) > test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) > > Buffer ioctls (Input 3): > test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK > test VIDIOC_EXPBUF: OK > > Test input 0: > > Streaming ioctls: > test read/write: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test MMAP: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test USERPTR: OK > test DMABUF: Cannot test, specify --expbuf-device > > Test input 1: > > Streaming ioctls: > test read/write: OK > warn: v4l2-test-buffers.cpp(235): V4L2_BUF_FLAG_TIMECODE was used! > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test MMAP: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test USERPTR: OK > test DMABUF: Cannot test, specify --expbuf-device > > Test input 2: > > Streaming ioctls: > test read/write: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test MMAP: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test USERPTR: OK > test DMABUF: Cannot test, specify --expbuf-device > > Test input 3: > > Streaming ioctls: > test read/write: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test MMAP: OK > > Video Capture: Frame #000 > Video Capture: Frame #001 > Video Capture: Frame #002 > Video Capture: Frame #003 > Video Capture: Frame #004 > Video Capture: Frame #005 > Video Capture: Frame #006 > Video Capture: Frame #007 > Video Capture: Frame #008 > Video Capture: Frame #009 > > > Video Capture: Frame #000 (polling) > Video Capture: Frame #001 (polling) > Video Capture: Frame #002 (polling) > Video Capture: Frame #003 (polling) > Video Capture: Frame #004 (polling) > Video Capture: Frame #005 (polling) > Video Capture: Frame #006 (polling) > Video Capture: Frame #007 (polling) > Video Capture: Frame #008 (polling) > Video Capture: Frame #009 (polling) > > test USERPTR: OK > test DMABUF: Cannot test, specify --expbuf-device > > Total: 118, Succeeded: 118, Failed: 0, Warnings: 2 > > > > > > Signed-off-by: Mauro Carvalho Chehab > > > > diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > > index 8c05dd9660d3..d2f0268427c2 100644 > > --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > > +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > > @@ -30,6 +30,24 @@ > > get_user(__assign_tmp, from) || put_user(__assign_tmp, to); \ > > }) > > > > +#define get_user_cast(__x, __ptr) \ > > +({ \ > > + get_user(__x, (typeof(*__ptr) __user *)(__ptr)); \ > > +}) > > + > > +#define put_user_force(__x, __ptr) \ > > +({ \ > > + put_user((typeof(*__x) __force *)(__x), __ptr); \ > > +}) > > + > > +#define assign_in_user_cast(to, from) \ > > +({ \ > > + typeof(*from) __assign_tmp; \ > > + \ > > + get_user_cast(__assign_tmp, from) || put_user(__assign_tmp, to);\ > > +}) > > + > > + > > static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) > > { > > long ret = -ENOIOCTLCMD; > > @@ -543,8 +561,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer __user *p64, > > return -EFAULT; > > > > uplane = aux_buf; > > - if (put_user((__force struct v4l2_plane *)uplane, > > - &p64->m.planes)) > > + if (put_user_force(uplane, &p64->m.planes)) > > return -EFAULT; > > > > while (num_planes--) { > > @@ -682,7 +699,7 @@ static int get_v4l2_framebuffer32(struct v4l2_framebuffer __user *p64, > > > > if (!access_ok(VERIFY_READ, p32, sizeof(*p32)) || > > get_user(tmp, &p32->base) || > > - put_user((void __force *)compat_ptr(tmp), &p64->base) || > > + put_user_force(compat_ptr(tmp), &p64->base) || > > assign_in_user(&p64->capability, &p32->capability) || > > assign_in_user(&p64->flags, &p32->flags) || > > copy_in_user(&p64->fmt, &p32->fmt, sizeof(p64->fmt))) > > @@ -831,8 +848,7 @@ static int get_v4l2_ext_controls32(struct file *file, > > if (aux_space < count * sizeof(*kcontrols)) > > return -EFAULT; > > kcontrols = aux_buf; > > - if (put_user((__force struct v4l2_ext_control *)kcontrols, > > - &p64->controls)) > > + if (put_user_force(kcontrols, &p64->controls)) > > return -EFAULT; > > > > for (n = 0; n < count; n++) { > > @@ -898,12 +914,11 @@ static int put_v4l2_ext_controls32(struct file *file, > > unsigned int size = sizeof(*ucontrols); > > u32 id; > > > > - if (get_user(id, (unsigned int __user *)&kcontrols->id) || > > + if (get_user_cast(id, &kcontrols->id) || > > put_user(id, &ucontrols->id) || > > - assign_in_user(&ucontrols->size, > > - (unsigned int __user *)&kcontrols->size) || > > + assign_in_user_cast(&ucontrols->size, &kcontrols->size) || > > copy_in_user(&ucontrols->reserved2, > > - (unsigned int __user *)&kcontrols->reserved2, > > + (void __user *)&kcontrols->reserved2, > > sizeof(ucontrols->reserved2))) > > return -EFAULT; > > > > @@ -916,7 +931,7 @@ static int put_v4l2_ext_controls32(struct file *file, > > size -= sizeof(ucontrols->value64); > > > > if (copy_in_user(ucontrols, > > - (unsigned int __user *)kcontrols, size)) > > + (void __user *)kcontrols, size)) > > return -EFAULT; > > > > ucontrols++; > > @@ -970,10 +985,9 @@ static int get_v4l2_edid32(struct v4l2_edid __user *p64, > > if (!access_ok(VERIFY_READ, p32, sizeof(*p32)) || > > assign_in_user(&p64->pad, &p32->pad) || > > assign_in_user(&p64->start_block, &p32->start_block) || > > - assign_in_user(&p64->blocks, > > - (unsigned char __user *)&p32->blocks) || > > + assign_in_user_cast(&p64->blocks, &p32->blocks) || > > get_user(tmp, &p32->edid) || > > - put_user((void __force *)compat_ptr(tmp), &p64->edid) || > > + put_user_force(compat_ptr(tmp), &p64->edid) || > > copy_in_user(p64->reserved, p32->reserved, sizeof(p64->reserved))) > > return -EFAULT; > > return 0; > > > > > > Thanks, > > Mauro > > > > Thanks, > Mauro Thanks, Mauro --- 32bits 2018-04-17 11:18:29.141240772 -0300 +++ 64bits 2018-04-17 11:18:40.635282341 -0300 @@ -1 +1 @@ -v4l2-compliance SHA : bc71e4a67c6fbc5940062843bc41e7c8679634ce, 32 bits +v4l2-compliance SHA : bc71e4a67c6fbc5940062843bc41e7c8679634ce, 64 bits