]> sourceware.org Git - lvm2.git/commitdiff
Avoid looping forever in _pv_analyze_mda_raw used by pvck.
authorAlasdair Kergon <agk@redhat.com>
Thu, 31 Jul 2008 13:07:01 +0000 (13:07 +0000)
committerAlasdair Kergon <agk@redhat.com>
Thu, 31 Jul 2008 13:07:01 +0000 (13:07 +0000)
WHATS_NEW
lib/config/config.c
lib/format_text/format-text.c

index 0cad5cba124920da7187d0129c13072f84dc687b..a45e4639856c2b1f46d935a931747c0e7e44e4f1 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.40 - 
 ================================
+  Avoid looping forever in _pv_analyze_mda_raw used by pvck.
   Change lvchange exit status to indicate if any part of the operation failed.
   Fix pvchange and pvremove to handle PVs without mdas.
   Refactor _text_pv_read and always return mda list if requested.
index 3166550a57168dd2cf7725f7c69f137151671ae2..1fb7e9b0574e01c8564bd0ea4f580163ff80ad80 100644 (file)
@@ -1276,7 +1276,7 @@ unsigned maybe_config_section(const char *str, unsigned len)
        begin_count = _count_tokens(str, len, TOK_SECTION_B);
        end_count = _count_tokens(str, len, TOK_SECTION_E);
 
-       if (begin_count && end_count && (begin_count - end_count == 0))
+       if (begin_count && end_count && (begin_count == end_count))
                return 1;
        else
                return 0;
index 24188526f6cc8bd41a5335faa48b1690b21c1b9a..e499af0bafa6ea3052905c3f9c96c20ddb57b409 100644 (file)
@@ -139,7 +139,7 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
        struct raw_locn *rlocn;
        uint64_t area_start;
        uint64_t area_size;
-       uint64_t prev_sector;
+       uint64_t prev_sector, prev_sector2;
        uint64_t latest_mrec_offset;
        int i;
        uint64_t offset;
@@ -184,8 +184,11 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
        offset2 = size2 = 0;
        i = 0;
        while (prev_sector != latest_mrec_offset) {
+               prev_sector2 = prev_sector;
                prev_sector = _get_prev_sector_circular(area_start, area_size,
                                                        prev_sector);
+               if (prev_sector > prev_sector2)
+                       goto_out;
                /*
                 * FIXME: for some reason, the whole metadata region from
                 * area->start to area->start+area->size is not used.
This page took 0.045513 seconds and 5 git commands to generate.