lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170221112015.GE16975@valkosipuli.retiisi.org.uk>
Date:   Tue, 21 Feb 2017 13:20:16 +0200
From:   Sakari Ailus <sakari.ailus@....fi>
To:     Pavel Machek <pavel@....cz>
Cc:     Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        mchehab@...nel.org, kernel list <linux-kernel@...r.kernel.org>,
        ivo.g.dimitrov.75@...il.com, sre@...nel.org, pali.rohar@...il.com,
        linux-media@...r.kernel.org
Subject: Re: [PATCH] omap3isp: avoid uninitialized memory

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 <pavel@....cz>
> 
> 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@....fi	XMPP: sailus@...iisi.org.uk

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ