]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix CPU bitmask truncation
authorWilliam Lee Irwin III <wli@holomorphy.com>
Fri, 20 Dec 2002 14:05:38 +0000 (06:05 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Fri, 20 Dec 2002 14:05:38 +0000 (06:05 -0800)
Fix task->cpus_allowed bitmask truncations on 64.bit architectures.

Originally by Bjorn Helgaas for 2.4.x.

include/linux/init_task.h
kernel/module.c

index d9b8c5d9b55cacc8229a42045c171ea2b49934e9..77bc3a1340acc0f3274b511f726e34b80695c12d 100644 (file)
@@ -63,7 +63,7 @@
        .prio           = MAX_PRIO-20,                                  \
        .static_prio    = MAX_PRIO-20,                                  \
        .policy         = SCHED_NORMAL,                                 \
-       .cpus_allowed   = -1,                                           \
+       .cpus_allowed   = ~0UL,                                         \
        .mm             = NULL,                                         \
        .active_mm      = &init_mm,                                     \
        .run_list       = LIST_HEAD_INIT(tsk.run_list),                 \
index c7dfc2ea7a3dd0804f94255b5236548cdaa681e7..c73b19336f1ee738112f19cdfa2de5bbe40f54a1 100644 (file)
@@ -210,7 +210,7 @@ static int stopref(void *cpu)
        struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
        setscheduler(current->pid, SCHED_FIFO, &param);
 #endif
-       set_cpus_allowed(current, 1 << (unsigned long)cpu);
+       set_cpus_allowed(current, 1UL << (unsigned long)cpu);
 
        /* Ack: we are alive */
        atomic_inc(&stopref_thread_ack);
@@ -271,7 +271,7 @@ static int stop_refcounts(void)
 
        /* FIXME: racy with set_cpus_allowed. */
        old_allowed = current->cpus_allowed;
-       set_cpus_allowed(current, 1 << (unsigned long)cpu);
+       set_cpus_allowed(current, 1UL << (unsigned long)cpu);
 
        atomic_set(&stopref_thread_ack, 0);
        stopref_num_threads = 0;