All of lore.kernel.org
 help / color / mirror / Atom feed
From: Edward Allcutt <emallcut@gleim.com>
To: lvm-devel@redhat.com
Subject: [PATCH] Fix overlap detection in _vg_write_raw()
Date: Wed, 15 Oct 2008 10:32:38 -0400	[thread overview]
Message-ID: <48F5FF06.7060704@gleim.com> (raw)

The tests for checking if the new metadata overlaps the old has a flaw.
The amount by which the new metadata wraps is compared to the offset of
the old metadata. However the old metadata offset is from the beginning
of the metadata header whereas new_wrap is from the beginning of the
text area.

My patch fixes this comparison by adding the offset of the text area in
the header to new_wrap.

The first patch[0] applies just this simple fix.

The second alternative patch[1] precomputes the end position of the new
metadata, which simplifies the later comparison. It also extends
new_wrap and old_wrap to uint64_t as all the sizes and offsets used to
calculate them and with which they are compared are already 64-bit.

I've not included the patches directly as I can't convince my MUA not to
wrap the long lines.

[0] - http://allcutt.me.uk/lvm-minimal.diff
[1] - http://allcutt.me.uk/lvm.diff

Thanks to agk for pointing out the location of the bug on IRC.

-- 
Edward Allcutt



                 reply	other threads:[~2008-10-15 14:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=48F5FF06.7060704@gleim.com \
    --to=emallcut@gleim.com \
    --cc=lvm-devel@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.