Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1229382 > unrolled thread

[PATCH 01/38] arm-cci: fix handling cpumask_any_but return value

Started byAndrzej Hajda <a.hajda@samsung.com>
First post2015-09-21 16:00 +0200
Last post2015-09-21 17:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 01/38] arm-cci: fix handling cpumask_any_but return value Andrzej Hajda <a.hajda@samsung.com> - 2015-09-21 16:00 +0200
    Re: [PATCH 01/38] arm-cci: fix handling cpumask_any_but return value Will Deacon <will.deacon@arm.com> - 2015-09-21 17:30 +0200

#1229382 — [PATCH 01/38] arm-cci: fix handling cpumask_any_but return value

FromAndrzej Hajda <a.hajda@samsung.com>
Date2015-09-21 16:00 +0200
Subject[PATCH 01/38] arm-cci: fix handling cpumask_any_but return value
Message-ID<qb9Nq-8s4-59@gated-at.bofh.it>
cpumask_any_but returns value >= nr_cpu_ids if there are no more CPUs.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/bus/arm-cci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index 577cc4b..22754d0 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -1314,7 +1314,7 @@ static int cci_pmu_cpu_notifier(struct notifier_block *self,
 		if (!cpumask_test_and_clear_cpu(cpu, &cci_pmu->cpus))
 			break;
 		target = cpumask_any_but(cpu_online_mask, cpu);
-		if (target < 0) // UP, last CPU
+		if (target >= nr_cpu_ids) // UP, last CPU
 			break;
 		/*
 		 * TODO: migrate context once core races on event->ctx have
-- 
1.9.1

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

[toc] | [next] | [standalone]


#1229477

FromWill Deacon <will.deacon@arm.com>
Date2015-09-21 17:30 +0200
Message-ID<qbbcu-2a3-5@gated-at.bofh.it>
In reply to#1229382
On Mon, Sep 21, 2015 at 02:33:33PM +0100, Andrzej Hajda wrote:
> cpumask_any_but returns value >= nr_cpu_ids if there are no more CPUs.
> 
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].
> 
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
>  drivers/bus/arm-cci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
> index 577cc4b..22754d0 100644
> --- a/drivers/bus/arm-cci.c
> +++ b/drivers/bus/arm-cci.c
> @@ -1314,7 +1314,7 @@ static int cci_pmu_cpu_notifier(struct notifier_block *self,
>  		if (!cpumask_test_and_clear_cpu(cpu, &cci_pmu->cpus))
>  			break;
>  		target = cpumask_any_but(cpu_online_mask, cpu);
> -		if (target < 0) // UP, last CPU
> +		if (target >= nr_cpu_ids) // UP, last CPU

We could also make target an int, to match the return type of
cpumask_any_but (on top of this change).

Regardless,

  Acked-by: Will Deacon <will.deacon@arm.com>

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web