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: <0c40e1ea-a565-2f8d-8460-16576ded3cb3@linux.intel.com>
Date:   Thu, 19 May 2022 10:47:28 +0300
From:   Mathias Nyman <mathias.nyman@...ux.intel.com>
To:     Tao Wang <quic_wat@...cinc.com>,
        Mathias Nyman <mathias.nyman@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "open list:USB XHCI DRIVER" <linux-usb@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: xhci: save hcd_priv memory of shared_hcd

On 19.5.2022 5.17, Tao Wang wrote:
> The shared_hcd->hcd_priv is not used in xhci, so not
> need to malloc hcd priv memory for shared_hcd.
> 
> Signed-off-by: Tao Wang <quic_wat@...cinc.com>
> ---
>   drivers/usb/host/xhci-plat.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 01dcfd7..a27dd3a 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -336,6 +336,11 @@ static int xhci_plat_probe(struct platform_device *pdev)
>   	device_set_wakeup_capable(&pdev->dev, true);
>   
>   	xhci->main_hcd = hcd;
> +	/*
> +	 * The shared_hcd->hcd_priv is not used in xhci,
> +	 * so not need to malloc hcd priv memory for shared_hcd.
> +	 */
> +	driver->hcd_priv_size = 0;

A change like this will probably come back and bite us later.
We already allocated the additional hcd_priv_size bytes for primary hcd.
Future code can no longer rely on driver->hcd_priv_size being valid after this.

If saving this amount of memory is important then maybe look into
__usb_create_hcd() and avoid allocating the extra bytes if the hcd is not
the primary hcd.

Thanks
-Mathias

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ