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: <1295914142.2420.29.camel@localhost>
Date:	Mon, 24 Jan 2011 19:09:02 -0500
From:	Andy Walls <awalls@...metrocast.net>
To:	Wolfram Sang <w.sang@...gutronix.de>
Cc:	linux-i2c@...r.kernel.org, Greg Kroah-Hartman <gregkh@...e.de>,
	Mauro Carvalho Chehab <mchehab@...hat.com>,
	Jarod Wilson <jarod@...hat.com>, Joe Perches <joe@...ches.com>,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/4] drivers/staging/lirc: Remove obsolete cleanup for
 clientdata

On Mon, 2011-01-24 at 11:44 +0100, Wolfram Sang wrote:
> A few new i2c-drivers came into the kernel which clear the clientdata-pointer
> on exit or error. This is obsolete meanwhile, the core will do it. Simplify the
> kfree() calls after that, the pointers don't need to be checked.
> 
> Signed-off-by: Wolfram Sang <w.sang@...gutronix.de>
> Cc: Greg Kroah-Hartman <gregkh@...e.de>
> Cc: Mauro Carvalho Chehab <mchehab@...hat.com>
> Cc: Andy Walls <awalls@...metrocast.net>

Nak.

In a module where I plan to do more cleanup and add reference counting
to struct IR, IR_tx, and IR_rx objects, I'd like the explicit "NULL"s in
pointer checks to stay in for now.

Removing the explicit constant "NULL" makes searching for checks against
NULL pointers more difficult when auditing the code (No red syntax
highlighting and a /NULL search misses).

Regards,
Andy


> Cc: Jarod Wilson <jarod@...hat.com>
> Cc: Joe Perches <joe@...ches.com>
> ---
> 
> Compile tested only.
> 
>  drivers/staging/lirc/lirc_zilog.c |   28 +++++++++-------------------
>  1 files changed, 9 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c
> index 3fe5f41..df1055f 100644
> --- a/drivers/staging/lirc/lirc_zilog.c
> +++ b/drivers/staging/lirc/lirc_zilog.c
> @@ -1214,15 +1214,12 @@ static int ir_remove(struct i2c_client *client)
>  
>  	/* Good-bye Rx */
>  	destroy_rx_kthread(ir->rx);
> -	if (ir->rx != NULL) {
> -		if (ir->rx->buf.fifo_initialized)
> -			lirc_buffer_free(&ir->rx->buf);
> -		i2c_set_clientdata(ir->rx->c, NULL);
> -		kfree(ir->rx);
> -	}
> +	if (ir->rx && ir->rx->buf.fifo_initialized)
> +		lirc_buffer_free(&ir->rx->buf);
> +
> +	kfree(ir->rx);
>  
>  	/* Good-bye Tx */
> -	i2c_set_clientdata(ir->tx->c, NULL);
>  	kfree(ir->tx);
>  
>  	/* Good-bye IR */
> @@ -1388,18 +1385,11 @@ out_unregister:
>  out_free_thread:
>  	destroy_rx_kthread(ir->rx);
>  out_free_xx:
> -	if (ir->rx != NULL) {
> -		if (ir->rx->buf.fifo_initialized)
> -			lirc_buffer_free(&ir->rx->buf);
> -		if (ir->rx->c != NULL)
> -			i2c_set_clientdata(ir->rx->c, NULL);
> -		kfree(ir->rx);
> -	}
> -	if (ir->tx != NULL) {
> -		if (ir->tx->c != NULL)
> -			i2c_set_clientdata(ir->tx->c, NULL);
> -		kfree(ir->tx);
> -	}
> +	if (ir->rx && ir->rx->buf.fifo_initialized)
> +		lirc_buffer_free(&ir->rx->buf);
> +
> +	kfree(ir->rx);
> +	kfree(ir->tx);
>  out_free_ir:
>  	del_ir_device(ir);
>  	kfree(ir);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ