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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110713081318.GB13701@linux-sh.org>
Date:	Wed, 13 Jul 2011 17:13:19 +0900
From:	Paul Mundt <lethal@...ux-sh.org>
To:	Julia Lawall <julia@...u.dk>
Cc:	David Brown <davidb@...eaurora.org>,
	kernel-janitors@...r.kernel.org,
	Daniel Walker <dwalker@...o99.com>,
	Bryan Huntsman <bryanh@...eaurora.org>,
	linux-arm-msm@...r.kernel.org, linux-fbdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/5] drivers/video/msm/mdp.c: adjust error handling code

On Mon, Jul 04, 2011 at 04:11:45PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@...u.dk>
> 
> Use the error handling code at the end of the function, rather than
> returning directly.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @r@
> identifier x;
> @@
> 
> kfree(x)
> 
> @@
> identifier r.x;
> expression E1!=0,E2,E3,E4;
> statement S;
> @@
> 
> (
> if (<+...x...+>) S
> |
> if (...) { ... when != kfree(x)
>                when != if (...) { ... kfree(x); ... }
>                when != x = E3
> * return E1;
> }
> ... when != x = E2
> if (...) { ... when != x = E4
>  kfree(x); ... return ...; }
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@...u.dk>
> 
Applied, thanks.

> I wonder if the error handling code at the end of the function should be
> calling clk_put as well?  In that case, having a separate label for this
> case would be useful.  Otherwise, one of error_request_irq and error_get_clk
> can be deleted
> 
The MSM implementation for it is simply a nop, so it's not going to
really matter one way or the other. In terms of general consistency it
might be worth implementing.

I expect that there are probably quite a few drivers that don't balance
out their clk_get()'s with clk_put()'s however, perhaps this is another
semantic patch candidate? At the very least it would be interesting to
see the statistics.
--
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