From patchwork Fri Sep 15 19:54:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 112755 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp997795qgf; Fri, 15 Sep 2017 12:55:24 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDxq4lkfevP8wP7Eye2Yk34UKxkxTdChyZ084Mw1XtsycgB50ehxtawWaEznsERpasTLNnG X-Received: by 10.159.218.75 with SMTP id x11mr4936457plv.92.1505505324545; Fri, 15 Sep 2017 12:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505505324; cv=none; d=google.com; s=arc-20160816; b=Pnjs/MQUoFsxZ+SUdrgKnreFvgCTkWVR/FuSyo0Xvhz2azmKZsvha4u2vtDel/JfYf 7PHfqu5NWMdRIGhVB81Qi8HLInsuCy3Xo82L4uVpi5QmmqFA8Pta3/j7tgwFO0RyMJNG VhIi5MASWAFEdfh8Pk/dqLkuL7IVYVwaOCP9Q6ucnPxwCnJ4xXWEOM6RjjfuPMHIVBcK AwBwtzezhbc9Y0HkTL+byGTWYOd5OCs6Ig7RePSkKFVkyTChxpMW26RFH52rj0amMdF9 xPEyMCeWaQM7o5xwufVTV5jf/BXYR+tFXuZ8ejZKAdbtx+5Fuss48A12aQDbdtZlk6H1 QDPg== 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 :arc-authentication-results; bh=hyx5/JsbPtgcGsG+pCCywH5cPSyJ3603OBtZXn4cpxA=; b=BWwDKxhxjUfQLA0WkFGgOyuZV5GbXPC5RdQ7kHDp6Ef0jeIpFaOVrexlWQ6qYLniD8 slHkSn1LwnkXerNU34+1CZOcAQ2c1ekuaYhm/50pcwqrA1rwA8yoegx/xd1d0PbEYCxW FRtCT2SQlG4QlHBQ2AM3qVVDH9j1LW5wK//Bn45CCJqZUfwxfgxAl1BWefxXPXFS3X1L fj+TPdWlFK0vGN/29gx50fPFOfSLZujYSGG9NAHVKdySqU25mQYRvTR6iVZ8lqK78W9v VgqgOPhzqU/2hB1jrTTpBppNKDyJovkHSlmnjHZVweFmT3tGeRohamOlv2j0dZZr4orv f9/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-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 w7si1070774pgw.570.2017.09.15.12.55.24; Fri, 15 Sep 2017 12:55:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751616AbdIOTzX (ORCPT + 4 others); Fri, 15 Sep 2017 15:55:23 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:51088 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751562AbdIOTzW (ORCPT ); Fri, 15 Sep 2017 15:55:22 -0400 Received: from wuerfel.lan ([95.208.190.237]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0Mgpo8-1e6CGM0olc-00M2co; Fri, 15 Sep 2017 21:54:46 +0200 From: Arnd Bergmann To: Kyungmin Park , Sylwester Nawrocki , Mauro Carvalho Chehab , Kukjin Kim , Krzysztof Kozlowski Cc: Arnd Bergmann , Hans Verkuil , Julia Lawall , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] exynos4-is: properly initialize frame format Date: Fri, 15 Sep 2017 21:54:34 +0200 Message-Id: <20170915195441.1505586-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:g8Sjw3Qk9aPUAfvXaJYXVWDNedCaFue1lir0y2weWUcIFxQYFp4 0zUMWOL56RlazmzjnHpmmyIFHOr/bywEC3vx45QnsjHMaI+QyumPUd9jo8SQs5jiEyX7r7u QzUcgByxEm1AAQTAvWsczd87nW7bstxXguvTNuPDZgo9Z8Hj+9yF6mvNUeLa/hCjmaqx3QQ wdOZYBlZ561suZmL5hszA== X-UI-Out-Filterresults: notjunk:1; V01:K0:KTfPlT+0iRY=:nCAyiaPDqyEv5R+GaHsF3e Oze4vdcFSoIWv4E13e9KfuUZZyRR0o1E2m3ui8+6TKTpcV+8oboaOFTkPzt4ieYUaESUEMYjz hutMJ6QwRn+0t950bvUSinLan7w2xf5fCjYI5xGBPUvTO36Ep0yZCoUhRE5e3EgEE1FfR5lWz yjxVgHYRP0Vv1jRA1NNyV038yoW2hYf3+oeTuqk+gITZAKvFsUcltfJ2TcyBraFilnxrkfFdG K7/zyEg2aAEWZt+4QgYz325tllM7tfObw/NB1QoNRVcE2k4hP7B1ooPDow5BEbLw/KW8S7ffs T8aW2lD68/LW4yqTe1f+f3XhZc7sklJgovusqJp9IV+nDc91ltuPqqWLxhazMPaLHFl/UqFcG Tnt+Eiedgp60SXYHbPcNTpjPkikuJdzfNPOd2NXnRyTPFH598LEGXXgMGBULfWOFhBCiVqm0A hk9Onk1smDAMjhvdHagaRQiKX1Y2IfxLRJZJ85ncprmQEaZKxpnKqaE6TY1675u+R1ejr6Y8T 99QO4WWwDDFiEB6xgBFL4KpFR+TjOxxQYc7+SvMEI3Gf8DyjnEi6G8GsAx4iSS4xE3qL47jEO UU2zt/9+UwHCC8HfjM3LR517KJVOJusnR/Zv+huSNwahWUPXrBiY3o7/N7dmxQW6uYb9f39ou g/RSskfhkj9fG5VnR8gHWv+ZAoqdHx+HMRd0xMUek2J/2yHr7cNOCFpD9Pjb6+n2G9WdJ9/ia kjdi/qkqZJnPftevUnOHxvJzi9hygQSJUJXM8A== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org We copy the subdev frame format from a partially initialized structure, which is not entirely well-defined. Older compilers like gcc-4.4 can copy uninitialized stack data here and warn about it: drivers/media/platform/exynos4-is/fimc-isp.c: In function 'fimc_isp_subdev_open': drivers/media/platform/exynos4-is/fimc-isp.c:379: error: 'fmt.reserved[10u]' may be used uninitialized in this function drivers/media/platform/exynos4-is/fimc-isp.c:379: error: 'fmt.reserved[9u]' may be used uninitialized in this function ... drivers/media/platform/exynos4-is/fimc-isp.c:379: error: 'fmt.reserved[0u]' may be used uninitialized in this function drivers/media/platform/exynos4-is/fimc-isp.c:379: error: 'fmt.xfer_func' may be used uninitialized in this function On newer compilers, only the initialized fields get copied, but we should not rely on that, so this changes the code to zero-out the remaining fields first. Fixes: 9a761e436843 ("[media] exynos4-is: Add Exynos4x12 FIMC-IS driver") Signed-off-by: Arnd Bergmann --- drivers/media/platform/exynos4-is/fimc-isp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c index fd793d3ac072..9a48c0f69320 100644 --- a/drivers/media/platform/exynos4-is/fimc-isp.c +++ b/drivers/media/platform/exynos4-is/fimc-isp.c @@ -366,16 +366,16 @@ static int fimc_isp_subdev_s_power(struct v4l2_subdev *sd, int on) static int fimc_isp_subdev_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { - struct v4l2_mbus_framefmt fmt; struct v4l2_mbus_framefmt *format; + struct v4l2_mbus_framefmt fmt = { + .colorspace = V4L2_COLORSPACE_SRGB, + .code = fimc_isp_formats[0].mbus_code, + .width = DEFAULT_PREVIEW_STILL_WIDTH + FIMC_ISP_CAC_MARGIN_WIDTH, + .height = DEFAULT_PREVIEW_STILL_HEIGHT + FIMC_ISP_CAC_MARGIN_HEIGHT, + .field = V4L2_FIELD_NONE, + }; format = v4l2_subdev_get_try_format(sd, fh->pad, FIMC_ISP_SD_PAD_SINK); - - fmt.colorspace = V4L2_COLORSPACE_SRGB; - fmt.code = fimc_isp_formats[0].mbus_code; - fmt.width = DEFAULT_PREVIEW_STILL_WIDTH + FIMC_ISP_CAC_MARGIN_WIDTH; - fmt.height = DEFAULT_PREVIEW_STILL_HEIGHT + FIMC_ISP_CAC_MARGIN_HEIGHT; - fmt.field = V4L2_FIELD_NONE; *format = fmt; format = v4l2_subdev_get_try_format(sd, fh->pad, FIMC_ISP_SD_PAD_SRC_FIFO);