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: <20201204161249.GA1141609@rowland.harvard.edu>
Date:   Fri, 4 Dec 2020 11:12:49 -0500
From:   Alan Stern <stern@...land.harvard.edu>
To:     Bui Quang Minh <minhquangbui99@...il.com>
Cc:     Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Corentin Labbe <clabbe@...libre.com>,
        Jules Irenge <jbi.octave@...il.com>,
        Andrey Konovalov <andreyknvl@...il.com>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] USB: dummy-hcd: Fix uninitialized array use in init()

On Fri, Dec 04, 2020 at 06:24:49AM +0000, Bui Quang Minh wrote:
> This error path
> 
> 	err_add_pdata:
> 		for (i = 0; i < mod_data.num; i++)
> 			kfree(dum[i]);
> 
> can be triggered when not all dum's elements are initialized.
> 
> Fix this by initializing all dum's elements to NULL.
> 
> Signed-off-by: Bui Quang Minh <minhquangbui99@...il.com>
> ---
>  drivers/usb/gadget/udc/dummy_hcd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
> index 0eeaead..a2cf009 100644
> --- a/drivers/usb/gadget/udc/dummy_hcd.c
> +++ b/drivers/usb/gadget/udc/dummy_hcd.c
> @@ -2734,7 +2734,7 @@ static int __init init(void)
>  {
>  	int	retval = -ENOMEM;
>  	int	i;
> -	struct	dummy *dum[MAX_NUM_UDC];
> +	struct	dummy *dum[MAX_NUM_UDC] = {};
>  
>  	if (usb_disabled())
>  		return -ENODEV;

Acked-by: Alan Stern <stern@...land.harvard.edu>

Does this initialization end up using less memory than an explicit 
memset() call?

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ