From patchwork Wed Mar 28 18:12:37 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: 10313781 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 24DDA600F6 for ; Wed, 28 Mar 2018 18:13:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1506029B16 for ; Wed, 28 Mar 2018 18:13:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09B3429B42; Wed, 28 Mar 2018 18:13:23 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 A9C6129B16 for ; Wed, 28 Mar 2018 18:13:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753221AbeC1SNV (ORCPT ); Wed, 28 Mar 2018 14:13:21 -0400 Received: from osg.samsung.com ([64.30.133.232]:43209 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753130AbeC1SNS (ORCPT ); Wed, 28 Mar 2018 14:13:18 -0400 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id 9DFD73B597; Wed, 28 Mar 2018 11:13:18 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Qj8TQNA-sK88; Wed, 28 Mar 2018 11:13:17 -0700 (PDT) Received: from smtp.s-opensource.com (177.205.88.90.dynamic.adsl.gvt.net.br [177.205.88.90]) by osg.samsung.com (Postfix) with ESMTPSA id 041073B4E7; Wed, 28 Mar 2018 11:12:41 -0700 (PDT) Received: from mchehab by smtp.s-opensource.com with local (Exim 4.90_1) (envelope-from ) id 1f1FYs-0005KA-I8; Wed, 28 Mar 2018 15:12:38 -0300 From: Mauro Carvalho Chehab To: Linux Media Mailing List , stable@vger.kernel.org Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , Linux Kernel Mailing List Subject: [PATCH for v3.18 18/18] media: v4l2-compat-ioctl32: initialize a reserved field Date: Wed, 28 Mar 2018 15:12:37 -0300 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: 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 The get_v4l2_create32() function is missing a logic with would be cleaning a reserved field, causing v4l2-compliance to complain: Buffer ioctls (Input 0): fail: v4l2-test-buffers.cpp(506): check_0(crbufs.reserved, sizeof(crbufs.reserved)) test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index c76438dd3ead..ca0a43ad4ec8 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -247,7 +247,8 @@ static int get_v4l2_create32(struct v4l2_create_buffers __user *kp, { if (!access_ok(VERIFY_READ, up, sizeof(*up)) || copy_in_user(kp, up, - offsetof(struct v4l2_create_buffers32, format))) + offsetof(struct v4l2_create_buffers32, format)) || + copy_in_user(kp->reserved, up->reserved, sizeof(kp->reserved))) return -EFAULT; return __get_v4l2_format32(&kp->format, &up->format, aux_buf, aux_space);