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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <adab4546-632b-ae73-f3bc-b7fd306eedca@linuxfoundation.org>
Date:   Tue, 29 Mar 2022 08:32:47 -0600
From:   Shuah Khan <skhan@...uxfoundation.org>
To:     cgel.zte@...il.com, balbi@...nel.org
Cc:     gregkh@...uxfoundation.org, peter.chen@...nel.or,
        christophe.jaillet@...adoo.fr, lv.ruyi@....com.cn,
        johan@...nel.org, jakobkoschel@...il.com,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        Zeal Robot <zealci@....com.cn>,
        Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] usb: gadget: udc: add NULL pointer check

On 3/28/22 11:54 PM, cgel.zte@...il.com wrote:
> From: Lv Ruyi <lv.ruyi@....com.cn>
> 
> kzalloc() is a memory allocation function which can return NULL when some
> internal memory errors happen. It is safer to check NULL pointer.
> 

Please add information on how this problem was found, including the
tool used and warn message.

> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@....com.cn>
> ---
>   drivers/usb/gadget/udc/mv_udc_core.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c
> index fdb17d86cd65..f52eb3f2420a 100644
> --- a/drivers/usb/gadget/udc/mv_udc_core.c
> +++ b/drivers/usb/gadget/udc/mv_udc_core.c
> @@ -2231,6 +2231,10 @@ static int mv_udc_probe(struct platform_device *pdev)
>   
>   	/* allocate a small amount of memory to get valid address */
>   	udc->status_req->req.buf = kzalloc(8, GFP_KERNEL);
> +	if (!udc->status_req->req.buf) {
> +		retval = -ENOMEM;
> +		goto err_destroy_dma;
> +	}

Looks good to me.

>   	udc->status_req->req.dma = DMA_ADDR_INVALID;
>   
>   	udc->resume_state = USB_STATE_NOTATTACHED;
> 

With that change to the commit log

Reviewed-by: Shuah Khan <skhan@...uxfoundation.org>

thanks,
-- Shuah

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ