Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2669534pxb; Mon, 11 Jan 2021 16:40:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQ1nx1ZVj5I8qc5ZEGFOkp504CAZyo7BKThRnur73/COTWTr+UHnvAljDKmQ/iY0w9xsF7 X-Received: by 2002:a17:906:6a92:: with SMTP id p18mr1313739ejr.308.1610412014024; Mon, 11 Jan 2021 16:40:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610412014; cv=none; d=google.com; s=arc-20160816; b=KRPMVIvtGRaxcUbUWHsK9DjJds+O0tUrvdhJ1Uox/GZQCej7KfFbNu2f9UuFJ+okNj JgNVc+Gc2rOjlEkkB1oOEZ7w3kfEIaHNmiYnaQdSpzSn6/s+khIBvwXlUTLohFaHxSrS WUFvHOPNX1mC1hn/F4zGdRbtGmI9y3HbgHokea0i6hdts5yg1GRQJV+wqGneA6C3VXLM tJX4AQGIfPlM+E/OsI0UsTsuKvOLQlszs/ZBhklQoPx9xD7sqIFGHXS4iNOLhgYPn9Tx LEGtSkZHuUYZDf2nhgsQZUQyQ/a8zKxQ5dd14LD64fpRJzoH8yo5rYcmaceelO165gsX y/Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=x4giVY+SiPJUtzHh68eVHk/enokv74md1fC1UQtVQ+w=; b=X7RPegjK19nF1vLhzWftP8rYaXMww+1OuxoERg69lxHaqx9a/c60MqJ474UCcfIYTk Cz3UZiG6AzRwUHUbtGnl5OUdxAzLsPQ9EtyVN3hlFM68iERmInMoo2OblxLaqlkYqibz 9CSk+MvwW1eFcv5hR1rqkjx4XvR/uSP7+NMBx6TVyr/NX2Lv1gmcJW7+2QdQcChCs865 nMO5akitEsafZ8EKV7Ae/u/9LzNcNQQDEvpQ9sMdS2bbHS0DJgclb0MplHuKVtWJF3Pp 9Qq7YeJxIrtP5UUt7LboApavzICq/KAtt9PfniKC5u7JAnWw67mhYFDXW5NAEUx5ePR0 niXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x18si451796ejd.80.2021.01.11.16.39.49; Mon, 11 Jan 2021 16:40:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726315AbhAKMZq (ORCPT + 99 others); Mon, 11 Jan 2021 07:25:46 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:53536 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725858AbhAKMZq (ORCPT ); Mon, 11 Jan 2021 07:25:46 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 888DA1F44A81 Message-ID: <5b6d07096cbc19da68bbbfd29acb6c9ad584935b.camel@collabora.com> Subject: Re: [PATCH] hantro: Format IOCTLs compliance fixes From: Ezequiel Garcia To: Ricardo Ribalda Cc: Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Linux Media Mailing List , linux-rockchip@lists.infradead.org, devel@driverdev.osuosl.org, Linux Kernel Mailing List Date: Mon, 11 Jan 2021 09:24:55 -0300 In-Reply-To: References: <20210111113529.45488-1-ribalda@chromium.org> Organization: Collabora Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.2-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-01-11 at 13:22 +0100, Ricardo Ribalda wrote: > Hi Ezequiel > > On Mon, Jan 11, 2021 at 12:55 PM Ricardo Ribalda wrote: > > > > Hi Ezequiel > > > > On Mon, Jan 11, 2021 at 12:48 PM Ezequiel Garcia wrote: > > > > > > Hi Ricardo, > > > > > > On Mon, 2021-01-11 at 12:35 +0100, Ricardo Ribalda wrote: > > > > Clear the reserved fields. > > > > > > > > Fixes: > > > >   fail: v4l2-test-formats.cpp(482): pix_mp.plane_fmt[0].reserved not zeroed > > > > test VIDIOC_TRY_FMT: FAIL > > > >   fail: v4l2-test-formats.cpp(482): pix_mp.plane_fmt[0].reserved not zeroed > > > > test VIDIOC_S_FMT: FAIL > > > > > > > > Signed-off-by: Ricardo Ribalda > > > > --- > > > >  drivers/staging/media/hantro/hantro_v4l2.c | 5 +++++ > > > >  1 file changed, 5 insertions(+) > > > > > > > > diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c > > > > index b668a82d40ad..9b384fbffc93 100644 > > > > --- a/drivers/staging/media/hantro/hantro_v4l2.c > > > > +++ b/drivers/staging/media/hantro/hantro_v4l2.c > > > > @@ -239,6 +239,7 @@ static int hantro_try_fmt(const struct hantro_ctx *ctx, > > > >         const struct hantro_fmt *fmt, *vpu_fmt; > > > >         bool capture = V4L2_TYPE_IS_CAPTURE(type); > > > >         bool coded; > > > > +       int i; > > > > > > > >         coded = capture == ctx->is_encoder; > > > > > > > > @@ -293,6 +294,10 @@ static int hantro_try_fmt(const struct hantro_ctx *ctx, > > > >                         pix_mp->width * pix_mp->height * fmt->max_depth; > > > >         } > > > > > > > > +       for (i = 0; i < pix_mp->num_planes; i++) > > > > +               memset(pix_mp->plane_fmt[i].reserved, 0, > > > > +                      sizeof(pix_mp->plane_fmt[i].reserved)); > > > > + > > > > > > This looks like something that should be handled at the core, > > > probably in drivers/media/v4l2-core/v4l2-ioctl.c::v4l_try_fmt(). > > > > The core does clear the reserved field from v4l2_pix_format_mplane, > > My bad, It is also clearing the per plane reserved field. I was > testing in an old kernel. > OK, cool. > The grep it is still valid though. We can remove all the memsets in the drivers. > That would be very nice indeed. Thanks, Ezequiel