All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>,
	Muneendra Kumar <mkumar@redhat.com>,
	Martin Wilck <Martin.Wilck@suse.com>
Subject: [PATCH v2 01/14] libmultipath: make vector_foreach_slot_backwards work as expected
Date: Fri, 23 Aug 2019 12:48:45 -0500	[thread overview]
Message-ID: <1566582538-5979-2-git-send-email-bmarzins@redhat.com> (raw)
In-Reply-To: <1566582538-5979-1-git-send-email-bmarzins@redhat.com>

All of the code that uses vector_foreach_slot_backwards() treats "i" as
the index of the entry "p", but the way it was coded, that wasn't the
case. "i" was the number of the entry counting from 1, not 0.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 libmultipath/vector.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libmultipath/vector.h b/libmultipath/vector.h
index 41d2b896..344dffd5 100644
--- a/libmultipath/vector.h
+++ b/libmultipath/vector.h
@@ -40,7 +40,7 @@ typedef struct _vector *vector;
 #define vector_foreach_slot_after(v,p,i) \
 	for (; (v) && i < VECTOR_SIZE(v) && ((p) = (v)->slot[i]); i++)
 #define vector_foreach_slot_backwards(v,p,i) \
-	for (i = VECTOR_SIZE(v); i > 0 && ((p) = (v)->slot[i-1]); i--)
+	for (i = VECTOR_SIZE(v) - 1; (int)i >= 0 && ((p) = (v)->slot[i]); i--)
 
 #define identity(x) (x)
 /*
-- 
2.17.2

  reply	other threads:[~2019-08-23 17:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23 17:48 [PATCH v2 00/14] multipath marginal pathgroups Benjamin Marzinski
2019-08-23 17:48 ` Benjamin Marzinski [this message]
2019-08-23 17:48 ` [PATCH v2 02/14] libmultipath: add marginal paths and groups infrastructure Benjamin Marzinski
2019-08-23 17:48 ` [PATCH v2 03/14] tests: add path grouping policy unit tests Benjamin Marzinski
2019-08-23 17:48 ` [PATCH v2 04/14] libmultipath: add wrapper function around pgpolicyfn Benjamin Marzinski
2019-08-23 17:48 ` [PATCH v2 05/14] tests: update pgpolicy tests to work with group_paths() Benjamin Marzinski
2019-08-23 17:48 ` [PATCH v2 06/14] libmultipath: fix double free in pgpolicyfn error paths Benjamin Marzinski
2019-08-23 17:48 ` [PATCH v2 07/14] libmultipath: consolidate group_by_* functions Benjamin Marzinski
2019-08-23 17:48 ` [PATCH v2 08/14] libmultipath: make pgpolicyfn take a paths vector Benjamin Marzinski
2019-08-23 17:48 ` [PATCH v2 09/14] libmultipath: make group_paths handle marginal paths Benjamin Marzinski
2019-08-23 17:48 ` [PATCH v2 10/14] tests: add tests for grouping " Benjamin Marzinski
2019-08-23 17:48 ` [PATCH v2 11/14] libmultipath: add marginal_pathgroups config option Benjamin Marzinski
2019-08-23 17:48 ` [PATCH v2 12/14] libmutipath: deprecate delay_*_checks Benjamin Marzinski
2019-08-23 17:48 ` [PATCH v2 13/14] multipathd: use marginal_pathgroups Benjamin Marzinski
2019-08-23 17:48 ` [PATCH v2 14/14] multipath: update man pages Benjamin Marzinski
2019-08-30  7:09 ` [PATCH v2 00/14] multipath marginal pathgroups Martin Wilck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1566582538-5979-2-git-send-email-bmarzins@redhat.com \
    --to=bmarzins@redhat.com \
    --cc=Martin.Wilck@suse.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    --cc=mkumar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.