From d7bf9013c29e35520b6f5f737ee63a3594e892f5 Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Mon, 28 Aug 2017 16:44:20 -0600
Subject: [PATCH] Fix for possible unsigned iterator with negative bounds

Coverity 44943, 44944
---
 src/plugins/select/serial/job_test.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/plugins/select/serial/job_test.c b/src/plugins/select/serial/job_test.c
index cede9964c76..7b0d34d1ea3 100644
--- a/src/plugins/select/serial/job_test.c
+++ b/src/plugins/select/serial/job_test.c
@@ -335,9 +335,9 @@ clear_bit:	/* This node is not usable by this job */
 /* given an "avail" node_bitmap, return a corresponding "avail" core_bitmap */
 bitstr_t *_make_core_bitmap(bitstr_t *node_map)
 {
-	uint32_t n, c, nodes, size;
+	uint32_t c, nodes, size;
 	uint32_t coff;
-	int i_first, i_last;
+	int i, i_first, i_last;
 
 	nodes = bit_size(node_map);
 	size = cr_get_coremap_offset(nodes);
@@ -348,9 +348,9 @@ bitstr_t *_make_core_bitmap(bitstr_t *node_map)
 		i_last  = bit_fls(node_map);
 	else
 		i_last = -2;
-	for (n = i_first, c = 0; n <= i_last; n++) {
-		if (bit_test(node_map, n)) {
-			coff = cr_get_coremap_offset(n + 1);
+	for (i = i_first, c = 0; i <= i_last; i++) {
+		if (bit_test(node_map, i)) {
+			coff = cr_get_coremap_offset(i + 1);
 			while (c < coff) {
 				bit_set(core_map, c++);
 			}
-- 
GitLab