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: <52177499.4020703@samsung.com>
Date:	Fri, 23 Aug 2013 16:41:29 +0200
From:	Sylwester Nawrocki <s.nawrocki@...sung.com>
To:	Russell King - ARM Linux <linux@....linux.org.uk>
Cc:	linux-arm-kernel@...ts.infradead.org, mturquette@...aro.org,
	jiada_wang@...tor.com, robherring2@...il.com,
	grant.likely@...aro.org, broonie@...nel.org, vapier@...too.org,
	ralf@...ux-mips.org, kyungmin.park@...sung.com,
	shawn.guo@...aro.org, sebastian.hesselbarth@...il.com,
	LW@...O-electronics.de, t.figa@...sung.com, g.liakhovetski@....de,
	laurent.pinchart@...asonboard.com, linux-kernel@...r.kernel.org,
	uclinux-dist-devel@...ckfin.uclinux.org, linux-mips@...ux-mips.org,
	linux-sh@...r.kernel.org
Subject: Re: [PATCH v2 1/4] clk: add common __clk_get(),
 __clk_put()	implementations

On 08/20/2013 10:30 PM, Russell King - ARM Linux wrote:
> On Tue, Aug 20, 2013 at 07:34:20PM +0200, Sylwester Nawrocki wrote:
>> +int __clk_get(struct clk *clk)
>> +{
>> +	if (WARN_ON((!clk)))
>> +		return 0;
> 
> This changes the behaviour of clk_get()

My bad, will remove that.

>> +
>> +	if (!try_module_get(clk->owner))
>> +		return 0;
> 
> If you want this to be safe against NULL pointers, just do this:
> 
> 	if (clk && !try_module_get(clk->owner))
> 		return 0;

Ok, that should work too.

>> +
>> +	return 1;
>> +}
>> +EXPORT_SYMBOL(__clk_get);
>> +
>> +void __clk_put(struct clk *clk)
>> +{
>> +	if (!clk || IS_ERR(clk))
>> +		return;
>> +
>> +	module_put(clk->owner);
> 
> Calling clk_put() with an error-pointer should be a Bad Thing and something
> that shouldn't be encouraged, so trapping it is probably unwise.  So, just
> do here:
> 
> 	if (clk)
> 		module_put(clk->owner);
> 
> If we do have some callers of this with ERR pointers, then we could add:
> 
> 	if (WARN_ON_ONCE(IS_ERR(clk)))
> 		return;
> 
> and remove it after a full kernel cycle or so.

I wouldn't be surprised to see some callers with ERR pointers, since
clk_put() has been mostly a no op. I'm inclined to leave such a check
temporarily, let's see if it catches any issues.

Thanks for review of the other patches.
--
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