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] [day] [month] [year] [list]
Message-ID: <e6291d56-477e-980a-a8b4-de86e85d3851@cogentembedded.com>
Date:   Tue, 12 Jun 2018 11:55:15 +0300
From:   Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:     Zhouyang Jia <jiazhouyang09@...il.com>
Cc:     Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Kees Cook <keescook@...omium.org>,
        Allen Pais <allen.lkml@...il.com>, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: gadget: add error handling for
 platform_get_resource_byname

Hello!

On 6/12/2018 7:32 AM, Zhouyang Jia wrote:

> When platform_get_resource_byname fails, the lack of error-handling code may
> cause unexpected results.

    What results?

> This patch adds error-handling code after calling platform_get_resource_byname.
> 
> Signed-off-by: Zhouyang Jia <jiazhouyang09@...il.com>
> ---
>   drivers/usb/gadget/udc/r8a66597-udc.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c
> index a3ecce6..a7bd5e7 100644
> --- a/drivers/usb/gadget/udc/r8a66597-udc.c
> +++ b/drivers/usb/gadget/udc/r8a66597-udc.c
> @@ -1830,6 +1830,11 @@ static int r8a66597_sudmac_ioremap(struct r8a66597 *r8a66597,
>   	struct resource *res;
>   
>   	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sudmac");
> +	if (!res) {
> +		dev_err(&pdev->dev, "could not allocate resource.\n");
> +		return -ENODEV;
> +	}
> +
>   	r8a66597->sudmac_reg = devm_ioremap_resource(&pdev->dev, res);

    This function checks for 'res == NULL', no?

>   	return PTR_ERR_OR_ZERO(r8a66597->sudmac_reg);
>   }

MBR, Sergei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ