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: <20200203112818.GA3506060@ulmo>
Date:   Mon, 3 Feb 2020 12:28:18 +0100
From:   Thierry Reding <thierry.reding@...il.com>
To:     Dmitry Osipenko <digetx@...il.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jonathan Hunter <jonathanh@...dia.com>,
        Felipe Balbi <balbi@...nel.org>, linux-usb@...r.kernel.org,
        linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] usb: phy: tegra: Add clarifying comments about the
 shared registers

On Mon, Feb 03, 2020 at 01:42:59AM +0300, Dmitry Osipenko wrote:
> Tools like Coccinelle may erroneously recommend to use the
> devm_platform_ioremap_resource() API for the registers mapping because
> these tools are not aware about the implementation details of the driver.
> Let's add a clarifying comments to the code, which should help to stop
> future attempts to break the driver.
> 
> Signed-off-by: Dmitry Osipenko <digetx@...il.com>
> ---
>  drivers/usb/phy/phy-tegra-usb.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
> index 037e8eee737d..6153cc35aba0 100644
> --- a/drivers/usb/phy/phy-tegra-usb.c
> +++ b/drivers/usb/phy/phy-tegra-usb.c
> @@ -969,6 +969,10 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy,
>  		return  -ENXIO;
>  	}
>  
> +	/*
> +	 * Note that UTMI pad registers are shared by all PHYs, therefore
> +	 * devm_platform_ioremap_resource() can't be used here.
> +	 */
>  	tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start,
>  					   resource_size(res));
>  	if (!tegra_phy->pad_regs) {
> @@ -1087,6 +1091,10 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
>  		return  -ENXIO;
>  	}
>  
> +	/*
> +	 * Note that PHY and USB controller are using shared registers,
> +	 * therefore devm_platform_ioremap_resource() can't be used here.
> +	 */
>  	tegra_phy->regs = devm_ioremap(&pdev->dev, res->start,
>  				       resource_size(res));
>  	if (!tegra_phy->regs) {

I'm not sure it's really going to stop *all* attempts. But at least for
people that go through the trouble of reading the comments, yes, this
should do the trick, so:

Acked-by: Thierry Reding <treding@...dia.com>

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ