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] [day] [month] [year] [list]
Message-ID: <20160127234209.GF28687@dtor-ws>
Date:	Wed, 27 Jan 2016 15:42:09 -0800
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	Aniroop Mathur <a.mathur@...sung.com>
Cc:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	aniroop.mathur@...il.com
Subject: Re: [PATCH] Input: evdev: correct handling of memory allocation
 failure of evdev_client

Hi Aniroop,

On Mon, Jan 25, 2016 at 11:20:05PM +0530, Aniroop Mathur wrote:
> Lets fix twice checking of memory allocation failure of evdev_client
> structure when allocated successfully.

I think compiler will take care of optimizing away the 2nd check, so I'd
leave the code as is.

Thanks.

> 
> Signed-off-by: Aniroop Mathur <a.mathur@...sung.com>
> ---
>  drivers/input/evdev.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
> index e9ae3d5..102b5d9 100644
> --- a/drivers/input/evdev.c
> +++ b/drivers/input/evdev.c
> @@ -503,10 +503,11 @@ static int evdev_open(struct inode *inode, struct file *file)
>  	int error;
>  
>  	client = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
> -	if (!client)
> +	if (!client) {
>  		client = vzalloc(size);
> -	if (!client)
> -		return -ENOMEM;
> +		if (!client)
> +			return -ENOMEM;
> +	}
>  
>  	client->bufsize = bufsize;
>  	spin_lock_init(&client->buffer_lock);
> -- 
> 2.6.2
> 

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ