From patchwork Sun Jan 29 02:34:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 648853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05F51C38142 for ; Sun, 29 Jan 2023 02:34:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233982AbjA2Ceu (ORCPT ); Sat, 28 Jan 2023 21:34:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233952AbjA2Ceq (ORCPT ); Sat, 28 Jan 2023 21:34:46 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BB2F23339 for ; Sat, 28 Jan 2023 18:34:45 -0800 (PST) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 068C2327; Sun, 29 Jan 2023 03:34:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1674959684; bh=FAl/jCMRZUkPmLGBZdKzLljzgRIsxehGtNBJTqOM80c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MU/pNIYEpeqsf8OMtpeYcG2ZTAwl6d2+YHv7QiEeDq4kp0VGdUwRhvpm6KtB/3O1i aw5l56nmHnOSX1wRvX/c/PRtF75rKAv8FJtuD7s/RzmFJ3BfLTuRSO2QK8VFeqlCSZ TW1v8n6nOInxFUr39hAJpEMo0Mp/NGkD+7gVQUWg= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Adam Ford , Martin Kepplinger , Paul Elder , Rui Miguel Silva , kernel@pengutronix.de, linux-imx@nxp.com Subject: [PATCH v2 7/8] media: imx: imx7-media-csi: Zero format struct before calling .get_fmt() Date: Sun, 29 Jan 2023 04:34:28 +0200 Message-Id: <20230129023429.22467-8-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230129023429.22467-1-laurent.pinchart@ideasonboard.com> References: <20230129023429.22467-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The v4l2_subdev_format structure passed to the .get_fmt() subdev operation in imx7_csi_video_validate_fmt() isn't zeroed, which can cause undefined behaviour. Fix it. Signed-off-by: Laurent Pinchart --- drivers/media/platform/nxp/imx7-media-csi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c index 733e44700ff9..943e541768bd 100644 --- a/drivers/media/platform/nxp/imx7-media-csi.c +++ b/drivers/media/platform/nxp/imx7-media-csi.c @@ -1412,13 +1412,14 @@ static void imx7_csi_video_buf_queue(struct vb2_buffer *vb) static int imx7_csi_video_validate_fmt(struct imx7_csi *csi) { - struct v4l2_subdev_format fmt_src; + struct v4l2_subdev_format fmt_src = { + .pad = IMX7_CSI_PAD_SRC, + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; const struct imx7_csi_pixfmt *cc; int ret; /* Retrieve the media bus format on the source subdev. */ - fmt_src.pad = IMX7_CSI_PAD_SRC; - fmt_src.which = V4L2_SUBDEV_FORMAT_ACTIVE; ret = v4l2_subdev_call(&csi->sd, pad, get_fmt, NULL, &fmt_src); if (ret) return ret;