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:	Tue, 12 Jul 2016 17:11:26 +0200 (CEST)
From:	Anna-Maria Gleixner <anna-maria@...utronix.de>
To:	Daniel Lezcano <daniel.lezcano@...aro.org>
cc:	tglx@...utronix.de, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 44/93] clocksource/drivers/time-armada-370-xp: Convert
 init function to return error

On Thu, 7 Jul 2016, Daniel Lezcano wrote:

> The init functions do not return any error. They behave as the following:
> 
>   - panic, thus leading to a kernel crash while another timer may work and
>        make the system boot up correctly
> 
>   or
> 
>   - print an error and let the caller unaware if the state of the system
> 
> Change that by converting the init functions to return an error conforming
> to the CLOCKSOURCE_OF_RET prototype.
> 
> Proper error handling (rollback, errno value) will be changed later case
> by case, thus this change just return back an error or success in the init
> function.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
> ---
>  drivers/clocksource/time-armada-370-xp.c | 102 +++++++++++++++++++++++--------
>  1 file changed, 76 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
> index 601dbf74..bc4ab48 100644
> --- a/drivers/clocksource/time-armada-370-xp.c
> +++ b/drivers/clocksource/time-armada-370-xp.c
> @@ -323,33 +336,54 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)
>  				"armada_370_xp_per_cpu_tick",
>  				armada_370_xp_evt);
>  	/* Immediately configure the timer on the boot CPU */
> -	if (!res)
> -		armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
> +	if (res) {
> +		pr_err("Failed to request percpu irq");
> +		return res;
> +	}
> +
> +	res = armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
> +	if (!res) {

I think the "!" is a mistake, because armada_370_xp_timer_setup()
returns zero. See delta patch fixing this below.

> +		pr_err("Failed to setup timer");
> +		return res;
> +	}


8<-------------------
--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -342,7 +342,7 @@ static int __init armada_370_xp_timer_co
 	}
 
 	res = armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt));
-	if (!res) {
+	if (res) {
 		pr_err("Failed to setup timer");
 		return res;
 	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ