From patchwork Fri Feb 22 10:17:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 159016 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1553550jaa; Fri, 22 Feb 2019 02:17:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IaTrvtOEW4o3DFQnzv2oXqicz3HeJq9wjHkqS3DKnot06K2JbxopKtH/jcQZd8RC6qMhB9C X-Received: by 2002:a63:e752:: with SMTP id j18mr3197671pgk.313.1550830648923; Fri, 22 Feb 2019 02:17:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550830648; cv=none; d=google.com; s=arc-20160816; b=Ul11KhOYygHMa3yJnF9cdaveASoewTQ1Whzuxnns8KOxHwiADORZs0zVTOjZw0qsU/ KIQIH2i9T0uEspLhGuPE18YgQtyGQ1GMAWWFYh+IvmWpRnVL0C9eIu/EAyvvq+ycjvfi +VnlWWdUBfaYQqe+lUYLIl/ymN11jOzIuXrP2h7Ra/nQHztYc7VCYn29M4ALtZ24o0M0 jdZ7Es1fNrfWIQfXDhd3E+LycUAXG4qe1kRHc9x2h3FI8aEpff7p8z+t7pq6pFA4Yle3 bsrK6YwNIwiNfR0dIjtzj1pLaM7ohiaRFQdvcKj97QuwWUnGkDcDN433859KcBiXR/Oa OZMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zv0rxKqQsLgGZ5uFT0zZ4DKYZwC9uuUeZe3dGDeLZoY=; b=DepW0bN6L0+o0wH+bECrXcjEmSU3Y2Lr5RgBveImEW/VPGJExkOxG7P20P1nW5JdVe xLeYKiOP/UBOezItnh32wyvnCnML5JhoKqc3jy6vEXizTb0to7I3FXxnZYnC7ZFKwC5L mj/dlSc5I4jVz0fJEKhC/TrsBewUBNyIeASqYZRgC8RUWVa5+3sWZv+au58R/xnXjTvP rbhs3g7yRBZ0/rtRGvIJcmiayywuF8mY/rC6ErZSGR3epQuslvVy4Gk+ZPj8sGNsBXFw OHzeGdsvkABZ4dH5YpUOYxeAi+oWb64DBVXFOrHavFaoteTQkm7PqbbP5om40auSkwqI xADQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BLLZucUn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si1018634pgb.128.2019.02.22.02.17.28; Fri, 22 Feb 2019 02:17:28 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=BLLZucUn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726766AbfBVKR2 (ORCPT + 3 others); Fri, 22 Feb 2019 05:17:28 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:34154 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbfBVKR1 (ORCPT ); Fri, 22 Feb 2019 05:17:27 -0500 Received: by mail-wm1-f67.google.com with SMTP id y185so8556380wmd.1 for ; Fri, 22 Feb 2019 02:17:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zv0rxKqQsLgGZ5uFT0zZ4DKYZwC9uuUeZe3dGDeLZoY=; b=BLLZucUne98WFjnJEEt3bw0LmB0+hTEibOqg5jzSX/RyWO+eELpYp2K1wkcfzIvDI1 XIWYNpEX2r3Zgiy337MB98krg+ZPVhJTrNlJO6JuXE7ATiQSidqAf6vVTL25V8x2p9Fy a+NpHsopCNGan62dztwHrXk8oUVeuGcXFV3ExhUX6sS5mBKA/aV/lMszgU81wtut7Aqu cKSc8gkEfBNiywiuk9Kc9lqvmQVrxtGTlxOllYlsgy96ulgmkWosbtcBl2i66jES797X SALXJxRgdw9pNdLDahPlXWQhin9i70EXu2Hftw+6tyNQejukxVzjtsIx8am+9zzN6qyh O0GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zv0rxKqQsLgGZ5uFT0zZ4DKYZwC9uuUeZe3dGDeLZoY=; b=ATp2/GLQsfeUzybMOKhzvKdxaHBUw08BnKnC6g5CnPmYbkyzI19S6uP3ML+NPH/Ki9 9CTdMkyWCs58qjx/Ugy7p2tHKpUiWJicuRJu8fZFCNwZIYPdFo8MtrBkYUwDA6TTUX0E p04DSb6zDTunu+MPlqmqXw2xOo6CWIqsc5ZeAwz5AQ+Bj47qNUKKupoQxkKw7UJdH8wU igY7pfZNl+18KvK6SgP++p3lfFOXh8x3lWiUPRJ1Bhn3q53eeb/5RFDPwmhV556/oo99 7H2zBJYVwS4hN/WlO4WG3VtCXDN2Tp0IAtNNc07Wl2146+CzBCBs7I+IT4ZRTr6Y8zcy eWgw== X-Gm-Message-State: AHQUAuYAu5Esz7MDs/VtjZjISDHPFvvn/QyTuQCOQ/zF6u1MjEIuANRP jVhoeBYJTu6P9kRWiePbPDgg9g== X-Received: by 2002:a1c:cf43:: with SMTP id f64mr1826846wmg.61.1550830645979; Fri, 22 Feb 2019 02:17:25 -0800 (PST) Received: from arch-late.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id u12sm1141064wmf.44.2019.02.22.02.17.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 02:17:25 -0800 (PST) From: Rui Miguel Silva To: Mauro Carvalho Chehab , Dan Carpenter , Hans Verkuil Cc: linux-media@vger.kernel.org, Rui Miguel Silva Subject: [PATCH] media: imx7-media-csi: don't store a floating pointer Date: Fri, 22 Feb 2019 10:17:10 +0000 Message-Id: <20190222101710.28465-1-rui.silva@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190222070143.GF1711@kadam> References: <20190222070143.GF1711@kadam> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org if imx7_csi_try_fmt() fails, cc variable won't be initialized and csi->cc[sdformat->pad] would be pointing to a random location. Reported-by: Dan Carpenter Signed-off-by: Rui Miguel Silva --- drivers/staging/media/imx/imx7-media-csi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 3fba7c27c0ec..894e5be3f17c 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -1051,7 +1051,9 @@ static int imx7_csi_set_fmt(struct v4l2_subdev *sd, goto out_unlock; } - imx7_csi_try_fmt(csi, cfg, sdformat, &cc); + ret = imx7_csi_try_fmt(csi, cfg, sdformat, &cc); + if (ret < 0) + goto out_unlock; fmt = imx7_csi_get_format(csi, cfg, sdformat->pad, sdformat->which); if (!fmt) {