From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2273C63697 for ; Sun, 22 Nov 2020 00:49:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7CC4A207F7 for ; Sun, 22 Nov 2020 00:49:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726983AbgKVAs7 (ORCPT ); Sat, 21 Nov 2020 19:48:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726398AbgKVAs7 (ORCPT ); Sat, 21 Nov 2020 19:48:59 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2969C0613CF; Sat, 21 Nov 2020 16:48:58 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 2183B1F45C12 Message-ID: <36568623119c57a6d5253300ad937aeb708f4ec8.camel@collabora.com> Subject: Re: [PATCH v3 07/13] media: controls: Validate H264 stateless controls From: Ezequiel Garcia To: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel@collabora.com, Jonas Karlman , Nicolas Dufresne , Philipp Zabel , Maxime Ripard , Paul Kocialkowski , Jernej Skrabec Date: Sat, 21 Nov 2020 21:48:48 -0300 In-Reply-To: References: <20201118184700.331213-1-ezequiel@collabora.com> <20201118184700.331213-8-ezequiel@collabora.com> Organization: Collabora Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.3-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-11-20 at 10:30 +0100, Hans Verkuil wrote: > On 18/11/2020 19:46, Ezequiel Garcia wrote: > > Check that all the fields that correspond or are related > > to a H264 specification syntax element have legal values. > > > > Signed-off-by: Ezequiel Garcia > > --- > > drivers/media/v4l2-core/v4l2-ctrls.c | 83 ++++++++++++++++++++++++++++ > > 1 file changed, 83 insertions(+) > > [..] > > case V4L2_CTRL_TYPE_H264_DECODE_PARAMS: > > p_h264_dec_params = p; > > > > + if (p_h264_dec_params->nal_ref_idc > 3) > > + return -EINVAL; > > for (i = 0; i < V4L2_H264_NUM_DPB_ENTRIES; i++) { > > struct v4l2_h264_dpb_entry *dpb_entry = > > &p_h264_dec_params->dpb[i]; > > > > General question: I don't see anything in std_init_compound() for these > controls. Is initializing these compound controls to 0 enough to make them > pass std_validate_compound()? It probably is, otherwise you'd see errors > in the compliance test, I guess. > guess. > Indeed. You can see all the checks are for fields to not exceed some maximum value. This is common in H264/HEVC: you'll see spread of _minusN syntax. This is so to make zero-valued syntax common, which in turns creates more redundancy, and make headers more compressed. Thanks, Ezequiel