From: Jan Kiszka <[email protected]>

This brings us below default CONFIG_FRAME_WARN with CONFIG_MAXSMP=y on
x86, avoiding the related compile-time warning.

Reported-by: Florian Bezdeka <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
---

The first idea was to make the vars static, but the handler is actually 
not running under any lock, thus this would have been ugly - at best.

 kernel/cobalt/sched.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index 222d0dd408..88c4951ed8 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -1381,7 +1381,7 @@ static int affinity_vfile_show(struct 
xnvfile_regular_iterator *it,
 
 static ssize_t affinity_vfile_store(struct xnvfile_input *input)
 {
-       cpumask_t affinity, set;
+       cpumask_t affinity;
        ssize_t ret;
        long val;
        int cpu;
@@ -1396,21 +1396,21 @@ static ssize_t affinity_vfile_store(struct 
xnvfile_input *input)
        else {
                cpumask_clear(&affinity);
                for (cpu = 0; cpu < BITS_PER_LONG; cpu++, val >>= 1) {
-                       if (val & 1)
+                       if (val & 1) {
+                               /*
+                                * The new dynamic affinity must be a strict
+                                * subset of the static set of supported CPUs.
+                                */
+                               if (!cpumask_test_cpu(cpu,
+                                                     &xnsched_realtime_cpus))
+                                       return -EINVAL;
                                cpumask_set_cpu(cpu, &affinity);
+                       }
                }
        }
 
-       cpumask_and(&set, &affinity, cpu_online_mask);
-       if (cpumask_empty(&set))
-               return -EINVAL;
-
-       /*
-        * The new dynamic affinity must be a strict subset of the
-        * static set of supported CPUs.
-        */
-       cpumask_or(&set, &affinity, &xnsched_realtime_cpus);
-       if (!cpumask_equal(&set, &xnsched_realtime_cpus))
+       cpumask_and(&affinity, &affinity, cpu_online_mask);
+       if (cpumask_empty(&affinity))
                return -EINVAL;
 
        xnlock_get_irqsave(&nklock, s);
-- 
2.31.1

Reply via email to