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]
Date:	Fri, 12 Dec 2008 07:36:45 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Magnus Damm <magnus.damm@...il.com>
Cc:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	johnstul@...ibm.com, lethal@...ux-sh.org, tglx@...utronix.de,
	mingo@...hat.com
Subject: Re: [PATCH] clocksource: add enable() and disable() callbacks


* Magnus Damm <magnus.damm@...il.com> wrote:

> +static inline int clocksource_enable(struct clocksource *cs)
> +{
> +	return cs->enable ? cs->enable(cs) : 0;
> +}

> +static inline void clocksource_disable(struct clocksource *cs)
> +{
> +	if (cs->disable)
> +		cs->disable(cs);
> +}

why have the two different styles? The first one should be:

	if (cs->enable)
		return cs->enable(cs);
	return 0;

> @@ -193,11 +193,16 @@ static void change_clocksource(void)
>  
>  	clocksource_forward_now();
>  
> -	new->raw_time = clock->raw_time;
> +	if (clocksource_enable(new))
> +		return;

that looks fragile to me: if the enable fails we'll return silently, 
while change_clocksource() assumes that things went fine. At least put a 
WARN_ON_ONCE() in there.

also, why does it have to fail? If a clocksource cannot be enabled it 
should not be offered as a clocksource.

> +	clocksource_disable(old);

i do agree with the core purpose here, to allow lowlevel code to 
deactivate unused clocksources.

John, Thomas, what's your take on this?

	Ingo
--
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