Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp440035ybl; Tue, 28 Jan 2020 06:03:23 -0800 (PST) X-Google-Smtp-Source: APXvYqzSH3vD2u18dK7sJMQhUviuLmLSQ0LH7HBvymb+Aftu7G92jEU/xj/3QbfN1tHLKBAPPuHM X-Received: by 2002:a05:6830:112:: with SMTP id i18mr16122084otp.209.1580220202885; Tue, 28 Jan 2020 06:03:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580220202; cv=none; d=google.com; s=arc-20160816; b=KJP5l+uFDK+uZta7mVi2jAaLWsmoazI1W2Gh8UZiag7nUIZaGuc4TekWq9ryD/CNqM tKYmTeBcE4pKeW2+vdygDjbkrqOh29FLjgRYnhuaPpfkNQVr3b1JBIvvakCAimjYV8wl +z0TRggSyCZgeKyeGv/OEp4WJ4aHWeHc3HiWTodBP9Hq86jkwiFzwNqlNJBIQurWP4/M aN9N9gyqABckNk/mE3zDnrlWSchT9t9X2CRsFBHDJE/+tBuPf9z9qet1rZQObB0YDbwf cNpXGPK761D4Ry8tnm0bR/qnEFMnw+i1Zi7JzHBCq7ARym/5O4d0Ip2lasGMsxtGCPO2 yE0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SEvn80BxRRsoMWh4+e/SRocoXndpB1IUWBZY4Urm7Ck=; b=sGQpngwLzcJ6XKmk7xYpx/JdlwI/HZPBUCBHa9sR5xi9dwnuX87PU+CbfaremSp7xO tX8z43BuF2OtexvcnMKsCAggcX9TKSdW8qK18miTznGqVedOerYVypu82/RbdQHxnwyI /qlGF33BTyDoIRQ3fZhjFDTnzzt5hlJtVnxw5adtGF0L9KR4I0ohLTmNeKWgrcI1xzTO HRScfv1wRVToYT94bww4Qgkv1jX3VY+v+MQQTtzqeldcRw9c+bUTFrGq/6hidXleNVAZ qctyEVsvGgxsaEA1yQ9AOLDaZKhu/LynvUXeV3LjgQ/iHUCW1RxENywpZk2cSyygQ+7B a+vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="L0Vvm/Pg"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r21si7017541ota.204.2020.01.28.06.03.08; Tue, 28 Jan 2020 06:03:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="L0Vvm/Pg"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727134AbgA1N7v (ORCPT + 99 others); Tue, 28 Jan 2020 08:59:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:45276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727124AbgA1N7s (ORCPT ); Tue, 28 Jan 2020 08:59:48 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1AC4B2173E; Tue, 28 Jan 2020 13:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580219987; bh=VuZpuW+dKu4x+uDn4XeU2iKAEIXGuHGdpf8++Js0hxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L0Vvm/Pg1scABhCjeX+iAzySzTSZ/d0WcE/rMcA7h28PooXhf5GZIEgWPCA1SKL+h BF0sYX3/FrdYeCD+8uU2GAZB6Hs++1ewj+oQx+/QvVC9YU9x3fpcQzf1SI2SeYp6A2 a9rmhnUSUEwICjrxcQJ++K5XuATFrpGy8fTrAMfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 4.14 41/46] media: v4l2-ioctl.c: zero reserved fields for S/TRY_FMT Date: Tue, 28 Jan 2020 14:58:15 +0100 Message-Id: <20200128135755.133620718@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135749.822297911@linuxfoundation.org> References: <20200128135749.822297911@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Verkuil commit ee8951e56c0f960b9621636603a822811cef3158 upstream. v4l2_vbi_format, v4l2_sliced_vbi_format and v4l2_sdr_format have a reserved array at the end that should be zeroed by drivers as per the V4L2 spec. Older drivers often do not do this, so just handle this in the core. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/v4l2-core/v4l2-ioctl.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1496,12 +1496,12 @@ static int v4l_s_fmt(const struct v4l2_i case V4L2_BUF_TYPE_VBI_CAPTURE: if (unlikely(!ops->vidioc_s_fmt_vbi_cap)) break; - CLEAR_AFTER_FIELD(p, fmt.vbi); + CLEAR_AFTER_FIELD(p, fmt.vbi.flags); return ops->vidioc_s_fmt_vbi_cap(file, fh, arg); case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: if (unlikely(!ops->vidioc_s_fmt_sliced_vbi_cap)) break; - CLEAR_AFTER_FIELD(p, fmt.sliced); + CLEAR_AFTER_FIELD(p, fmt.sliced.io_size); return ops->vidioc_s_fmt_sliced_vbi_cap(file, fh, arg); case V4L2_BUF_TYPE_VIDEO_OUTPUT: if (unlikely(!ops->vidioc_s_fmt_vid_out)) @@ -1524,22 +1524,22 @@ static int v4l_s_fmt(const struct v4l2_i case V4L2_BUF_TYPE_VBI_OUTPUT: if (unlikely(!ops->vidioc_s_fmt_vbi_out)) break; - CLEAR_AFTER_FIELD(p, fmt.vbi); + CLEAR_AFTER_FIELD(p, fmt.vbi.flags); return ops->vidioc_s_fmt_vbi_out(file, fh, arg); case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: if (unlikely(!ops->vidioc_s_fmt_sliced_vbi_out)) break; - CLEAR_AFTER_FIELD(p, fmt.sliced); + CLEAR_AFTER_FIELD(p, fmt.sliced.io_size); return ops->vidioc_s_fmt_sliced_vbi_out(file, fh, arg); case V4L2_BUF_TYPE_SDR_CAPTURE: if (unlikely(!ops->vidioc_s_fmt_sdr_cap)) break; - CLEAR_AFTER_FIELD(p, fmt.sdr); + CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize); return ops->vidioc_s_fmt_sdr_cap(file, fh, arg); case V4L2_BUF_TYPE_SDR_OUTPUT: if (unlikely(!ops->vidioc_s_fmt_sdr_out)) break; - CLEAR_AFTER_FIELD(p, fmt.sdr); + CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize); return ops->vidioc_s_fmt_sdr_out(file, fh, arg); case V4L2_BUF_TYPE_META_CAPTURE: if (unlikely(!ops->vidioc_s_fmt_meta_cap)) @@ -1583,12 +1583,12 @@ static int v4l_try_fmt(const struct v4l2 case V4L2_BUF_TYPE_VBI_CAPTURE: if (unlikely(!ops->vidioc_try_fmt_vbi_cap)) break; - CLEAR_AFTER_FIELD(p, fmt.vbi); + CLEAR_AFTER_FIELD(p, fmt.vbi.flags); return ops->vidioc_try_fmt_vbi_cap(file, fh, arg); case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: if (unlikely(!ops->vidioc_try_fmt_sliced_vbi_cap)) break; - CLEAR_AFTER_FIELD(p, fmt.sliced); + CLEAR_AFTER_FIELD(p, fmt.sliced.io_size); return ops->vidioc_try_fmt_sliced_vbi_cap(file, fh, arg); case V4L2_BUF_TYPE_VIDEO_OUTPUT: if (unlikely(!ops->vidioc_try_fmt_vid_out)) @@ -1611,22 +1611,22 @@ static int v4l_try_fmt(const struct v4l2 case V4L2_BUF_TYPE_VBI_OUTPUT: if (unlikely(!ops->vidioc_try_fmt_vbi_out)) break; - CLEAR_AFTER_FIELD(p, fmt.vbi); + CLEAR_AFTER_FIELD(p, fmt.vbi.flags); return ops->vidioc_try_fmt_vbi_out(file, fh, arg); case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: if (unlikely(!ops->vidioc_try_fmt_sliced_vbi_out)) break; - CLEAR_AFTER_FIELD(p, fmt.sliced); + CLEAR_AFTER_FIELD(p, fmt.sliced.io_size); return ops->vidioc_try_fmt_sliced_vbi_out(file, fh, arg); case V4L2_BUF_TYPE_SDR_CAPTURE: if (unlikely(!ops->vidioc_try_fmt_sdr_cap)) break; - CLEAR_AFTER_FIELD(p, fmt.sdr); + CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize); return ops->vidioc_try_fmt_sdr_cap(file, fh, arg); case V4L2_BUF_TYPE_SDR_OUTPUT: if (unlikely(!ops->vidioc_try_fmt_sdr_out)) break; - CLEAR_AFTER_FIELD(p, fmt.sdr); + CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize); return ops->vidioc_try_fmt_sdr_out(file, fh, arg); case V4L2_BUF_TYPE_META_CAPTURE: if (unlikely(!ops->vidioc_try_fmt_meta_cap))