From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752104AbdBULU6 (ORCPT ); Tue, 21 Feb 2017 06:20:58 -0500 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:51994 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751563AbdBULUu (ORCPT ); Tue, 21 Feb 2017 06:20:50 -0500 Date: Tue, 21 Feb 2017 13:20:16 +0200 From: Sakari Ailus To: Pavel Machek Cc: Laurent Pinchart , mchehab@kernel.org, kernel list , ivo.g.dimitrov.75@gmail.com, sre@kernel.org, pali.rohar@gmail.com, linux-media@vger.kernel.org Subject: Re: [PATCH] omap3isp: avoid uninitialized memory Message-ID: <20170221112015.GE16975@valkosipuli.retiisi.org.uk> References: <20161228183036.GA13139@amd> <10545906.Gxg3yScdu4@avalon> <20170215094228.GA8586@amd> <2414221.XNA4JCFMRx@avalon> <20170220120647.GA19951@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170220120647.GA19951@amd> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pavel, On Mon, Feb 20, 2017 at 01:06:47PM +0100, Pavel Machek wrote: > > Code in ispcsiphy is quite confusing, and does not initialize phy1 in > case of isp rev. 2. Set it to zero, to prevent confusion. > > Signed-off-by: Pavel Machek > > index 8f73f6d..a2474b6 100644 > --- a/drivers/media/platform/omap3isp/ispcsiphy.c > +++ b/drivers/media/platform/omap3isp/ispcsiphy.c > @@ -362,14 +374,16 @@ int omap3isp_csiphy_init(struct isp_device *isp) > phy2->phy_regs = OMAP3_ISP_IOMEM_CSIPHY2; > mutex_init(&phy2->mutex); > > - if (isp->revision == ISP_REVISION_15_0) { > - phy1->isp = isp; > - phy1->csi2 = &isp->isp_csi2c; > - phy1->num_data_lanes = ISP_CSIPHY1_NUM_DATA_LANES; > - phy1->cfg_regs = OMAP3_ISP_IOMEM_CSI2C_REGS1; > - phy1->phy_regs = OMAP3_ISP_IOMEM_CSIPHY1; > - mutex_init(&phy1->mutex); > + if (isp->revision != ISP_REVISION_15_0) { > + memset(phy1, sizeof(*phy1), 0); > + return 0; Isn't the memory allocated using kzalloc(), meaning it's already zero? > } > > + phy1->isp = isp; > + phy1->csi2 = &isp->isp_csi2c; > + phy1->num_data_lanes = ISP_CSIPHY1_NUM_DATA_LANES; > + phy1->cfg_regs = OMAP3_ISP_IOMEM_CSI2C_REGS1; > + phy1->phy_regs = OMAP3_ISP_IOMEM_CSIPHY1; > + mutex_init(&phy1->mutex); > return 0; > } > > -- Kind regards, Sakari Ailus e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk