From patchwork Fri Nov 2 11:09:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 150023 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1937305ljp; Fri, 2 Nov 2018 04:09:59 -0700 (PDT) X-Google-Smtp-Source: AJdET5d4mH3ChxbqL1hB4CNAnG/pDhBJ0aAcBvlFqB+5rzrBYedK3roZVPSHDre9rBRqptyEAmrg X-Received: by 2002:a63:b218:: with SMTP id x24mr10226926pge.223.1541156999201; Fri, 02 Nov 2018 04:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541156999; cv=none; d=google.com; s=arc-20160816; b=ZSe0St7O2XQe0ejT8zWb3c+6ZYDUzxcY2qLmberpFUn/J5+K6ig9YeP9RPIFtwFXle XhZQjVsGhE9OjTYKPD1+X4vUaFmoG1ZelcUHQJBSPf9AJCa9COrbLviFvMr4kL2UWYmD ijxEO70PuNfducMDpRCTQl/LowUAIC4TkrsDz00IKxGz4OSsieQe6NM6/jg9Du717j96 7qHanl9Ss75KRnZgq1x9ip51ngL4nXoOKxXNBlSfPzbAn2RW0Tl4hgf+zwtaD5Hymp2Q Hb4Rf9sUPqGBXu7FKKTfob05Rc775OKEutKmC2uO6cEJ2fDOd+HT6MAON0Qw3DvMzQ+v 7V1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=9ky2J2rIPURi18OJl5cjAqL29iy7yMhbxTN7SxKloLc=; b=tRfGOcr1Z6Q/VADVKP8XbZ5LS1IFmA79/mV2wZnObnQvt+Mo45yd5xW1d2vaJeHThm DTbkOteoUdoD4c4hBPOt6BiJOKltFB5998JcvMrba3MjaNEZJt7QXhK+g/RapoYctya9 hnejl36zQ3lBksKeJTz01fXl2GocFXL+7aEhvWhIJ4dPPQURLVpAIENKcveN++ZcV1p5 j1BqGr+kAnMrwT76nSWafN/WA/kFTVEQVvBUyMEOBGvK3wLtakqWZFNgqHqI+fqmd6bW x/4kbkPcQfQHjb63GRiVxunVqi6LzWtXQZRHtnfRmGtPgVcmCPuLYjC0CtRVmvv21gjj vOag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-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 7-v6si33409880pgw.401.2018.11.02.04.09.58; Fri, 02 Nov 2018 04:09:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727150AbeKBUQo (ORCPT + 4 others); Fri, 2 Nov 2018 16:16:44 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:58613 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726241AbeKBUQo (ORCPT ); Fri, 2 Nov 2018 16:16:44 -0400 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPA (Nemesis) id 1MiIhU-1feW571P9C-00fP0i; Fri, 02 Nov 2018 12:09:47 +0100 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPA (Nemesis) id 1MiIhU-1feW571P9C-00fP0i; Fri, 02 Nov 2018 12:09:47 +0100 From: Arnd Bergmann To: Mauro Carvalho Chehab , Hans Verkuil Cc: Maxime Ripard , Arnd Bergmann , Sakari Ailus , Tomasz Figa , Paul Kocialkowski , Andy Shevchenko , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: v4l: fix uapi mpeg slice params definition Date: Fri, 2 Nov 2018 12:09:07 +0100 Message-Id: <20181102110945.191868-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:35aLqRlZn9pNYPaRE+C1Bsdex63Cbxu7XrzdJ0e63v1RH2Bgonl j63cVvtXrzUBT7IoQkyJYgJjbxxvyVhh3zqtX6L/RRjteXm2MD0gQfhyy3sTYs34jxSdbn6 vQmD2rO81Wf16xeVdveJRUxwTfZgqyA/B4DfDrbODsFxxIwz0qbOCz1FDRkug8gCi8mRlQr L+E1T322+1EwQ2dr/a7ew== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V01:K0:RuO3MS9HQxc=:97Ho3vEZaO2RgTysvCdlQ4 uLF1NjkkwT/4v/BBvS2VdJESRxbrRGBA6DSCD5wz1rDDk1K++I2FP1eWe30N/zwCJmgaIprFW MDOqKwJJgNiOZFgOAVuq+r7ixf/zvT2n+TSSnQ4FbyJF+jr0FT3RYsmZNLDebDdqbuQ4W5QKw t7/PMoEWW+tL6kpqEmF+LOJ3GelxrhfSr9zxfikS6g1v1YJU13xfbntgn5RfabA7Gpge3ck4y +wdSeXBkCw3xQyF0mUKaBvvNML8iZbZbboYZ43Fyw7FKkgeA6sdYFuK2LatQbOHVvoH8P2wTA Wn2/CgtytaCA9FfuLX5IdmtFF39MoU0oo8DMjr8OQxCtO2ZWgvSD78UNvshHBuzVWGa1yWfQo ilzYQJhh8vTG2FQTrFHBb/INl12BfNvOHYR7UmNF/Hwou3jFBrIkd8jZMuDsDI/qPzkHA2Dqm GXe7nblxMsYrbw+m8+F3AWRXCV8SPL+eLsI+RigeM5tRoYGCSXhIoLzJ7jBmIGZXhWaodLFYT JSDRgUds4HuJhOHUcsIkcpw1SP7vRDzMVOJLF6jPEiBfQU1BG7V4g4J9rfG3k3STvgiQ2+elf /1IZvB/8Venlj9zrYDyDTBD9op7BmmF8S4QaUF+BxJq7ImfLy0o3ewM4nT9EjyUNf1IzGOaYf XjxsTf0Ssxa/zWBpTM8pbKkUusHUQbV0MAxz898SWRwWqWi67YVCtzXCpsmVp5u+lN4o= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org We get a headers_check warning about the newly defined ioctl command structures: ./usr/include/linux/v4l2-controls.h:1105: found __[us]{8,16,32,64} type without #include This is resolved by including linux/types.h, as suggested by the warning, but there is another problem: Three of the four structures have an odd number of __u8 headers, but are aligned to 32 bit in the v4l2_ctrl_mpeg2_slice_params, so we get an implicit padding byte for each one. To solve that, let's add explicit padding that can be set to zero and verified in the kernel. Fixes: c27bb30e7b6d ("media: v4l: Add definitions for MPEG-2 slice format and metadata") Signed-off-by: Arnd Bergmann --- drivers/media/v4l2-core/v4l2-ctrls.c | 5 +++++ include/uapi/linux/v4l2-controls.h | 5 +++++ 2 files changed, 10 insertions(+) -- 2.18.0 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 6e37950292cd..5f2b033a7a42 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1664,6 +1664,11 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx, p_mpeg2_slice_params->forward_ref_index >= VIDEO_MAX_FRAME) return -EINVAL; + if (p_mpeg2_slice_params->pad || + p_mpeg2_slice_params->picture.pad || + p_mpeg2_slice_params->sequence.pad) + return -EINVAL; + return 0; case V4L2_CTRL_TYPE_MPEG2_QUANTIZATION: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 51b095898f4b..998983a6e6b7 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -50,6 +50,8 @@ #ifndef __LINUX_V4L2_CONTROLS_H #define __LINUX_V4L2_CONTROLS_H +#include + /* Control classes */ #define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ #define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ @@ -1110,6 +1112,7 @@ struct v4l2_mpeg2_sequence { __u8 profile_and_level_indication; __u8 progressive_sequence; __u8 chroma_format; + __u8 pad; }; struct v4l2_mpeg2_picture { @@ -1128,6 +1131,7 @@ struct v4l2_mpeg2_picture { __u8 alternate_scan; __u8 repeat_first_field; __u8 progressive_frame; + __u8 pad; }; struct v4l2_ctrl_mpeg2_slice_params { @@ -1142,6 +1146,7 @@ struct v4l2_ctrl_mpeg2_slice_params { __u8 backward_ref_index; __u8 forward_ref_index; + __u8 pad; }; struct v4l2_ctrl_mpeg2_quantization {