From cc242de33c5ed24adee538d199b651e596fe33e9 Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Wed, 25 May 2016 16:43:58 -0700
Subject: [PATCH] unitialized task binding variable

Fix for uninitialized variable in task binding logic, could leave tasks
    with fewer CPUs than intended.
bug 2766
---
 NEWS                                 | 2 ++
 src/plugins/task/affinity/affinity.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 40e242cca1d..8ddaadf0539 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ documents those changes that are of interest to users and administrators.
  -- Cray - Fix node list parsing in capmc_suspend/resume programs.
  -- Fix sbatch #BSUB parsing for -W and -M options.
  -- Fix GRES task layout bug that could cause slurmctld to abort.
+ -- Fix for uninitialized variable in task binding logic, could leave tasks
+    with fewer CPUs than intended.
 
 * Changes in Slurm 16.05.0rc2
 =============================
diff --git a/src/plugins/task/affinity/affinity.c b/src/plugins/task/affinity/affinity.c
index d4f4a558c0d..167c0fc9383 100644
--- a/src/plugins/task/affinity/affinity.c
+++ b/src/plugins/task/affinity/affinity.c
@@ -329,8 +329,10 @@ void reset_cpuset(cpu_set_t *new_mask, cpu_set_t *cur_mask)
 	cpu_set_t full_mask, newer_mask;
 	int cur_offset, new_offset = 0, last_set = -1;
 
-	if (!_is_power_cpu())
+	if (!_is_power_cpu()) {
+		CPU_OR(new_mask, new_mask, cur_mask);
 		return;
+	}
 
 	if (slurm_getaffinity(1, sizeof(full_mask), &full_mask)) {
 		/* Try to get full CPU mask from process init */
-- 
GitLab