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  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]
Date:   Thu, 9 Nov 2017 13:07:42 +0100
From:   Pali Rohár <pali.rohar@...il.com>
To:     Mario Limonciello <mario.limonciello@...l.com>
Cc:     dvhart@...radead.org, Andy Shevchenko <andy.shevchenko@...il.com>,
        LKML <linux-kernel@...r.kernel.org>,
        platform-driver-x86@...r.kernel.org
Subject: Re: [PATCH 1/2] platform/x86: dell-wmi-descriptor: check if memory
 was allocated

On Friday 03 November 2017 11:27:21 Mario Limonciello wrote:
> devm_kzalloc will return NULL pointer if no memory was allocated.
> This should be checked.  This problem also existed when the driver
> was dell-wmi.c.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@...l.com>

Reviewed-by: Pali Rohár <pali.rohar@...il.com>

> ---
>  drivers/platform/x86/dell-wmi-descriptor.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/platform/x86/dell-wmi-descriptor.c b/drivers/platform/x86/dell-wmi-descriptor.c
> index 3204c408e261..28ef5f37cfbf 100644
> --- a/drivers/platform/x86/dell-wmi-descriptor.c
> +++ b/drivers/platform/x86/dell-wmi-descriptor.c
> @@ -121,6 +121,11 @@ static int dell_wmi_descriptor_probe(struct wmi_device *wdev)
>  	priv = devm_kzalloc(&wdev->dev, sizeof(struct descriptor_priv),
>  	GFP_KERNEL);
>  
> +	if (!priv) {
> +		ret = -ENOMEM;
> +		goto out;
> +	}
> +
>  	priv->interface_version = buffer[2];
>  	priv->size = buffer[3];
>  	ret = 0;

-- 
Pali Rohár
pali.rohar@...il.com

Powered by blists - more mailing lists