Blame SOURCES/0036-libmultipath-make-vector_foreach_slot_backwards-work.patch

a1c519
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
a1c519
From: Benjamin Marzinski <bmarzins@redhat.com>
a1c519
Date: Fri, 24 May 2019 17:30:07 -0500
a1c519
Subject: [PATCH] libmultipath: make vector_foreach_slot_backwards work as
a1c519
 expected
a1c519
a1c519
All of the code that uses vector_foreach_slot_backwards() treats "i" as
a1c519
the index of the entry "p", but the way it was coded, that wasn't the
a1c519
case. "i" was the number of the entry counting from 1, not 0.
a1c519
a1c519
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
a1c519
---
a1c519
 libmultipath/vector.h | 2 +-
a1c519
 1 file changed, 1 insertion(+), 1 deletion(-)
a1c519
a1c519
diff --git a/libmultipath/vector.h b/libmultipath/vector.h
a1c519
index 41d2b89..344dffd 100644
a1c519
--- a/libmultipath/vector.h
a1c519
+++ b/libmultipath/vector.h
a1c519
@@ -40,7 +40,7 @@ typedef struct _vector *vector;
a1c519
 #define vector_foreach_slot_after(v,p,i) \
a1c519
 	for (; (v) && i < VECTOR_SIZE(v) && ((p) = (v)->slot[i]); i++)
a1c519
 #define vector_foreach_slot_backwards(v,p,i) \
a1c519
-	for (i = VECTOR_SIZE(v); i > 0 && ((p) = (v)->slot[i-1]); i--)
a1c519
+	for (i = VECTOR_SIZE(v) - 1; (int)i >= 0 && ((p) = (v)->slot[i]); i--)
a1c519
 
a1c519
 #define identity(x) (x)
a1c519
 /*
a1c519
-- 
a1c519
2.17.2
a1c519