From 01c438a96c82bf31ccda0721707fc90afa01a07e Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sun, 24 Nov 2013 19:00:53 +0100 Subject: [PATCH] format-text: ensure aligment is not 0 Make sure this path of code is not used for alignment == 0, to prevent division by 0. --- WHATS_NEW | 1 + lib/format_text/format-text.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index 55b17c0af..cd6314495 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.105 - ===================================== + Check for non-zero aligment in _text_pv_add_metadata_area() to not div by 0. Add allocation/use_blkid_wiping to lvm.conf to enable blkid wiping. Add configure --enable-blkid_wiping to use libblkid to detect signatures. Add -W/--wipesignatures lvcreate option to support wiping on new LVs. diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index 275d16f29..eb5c9e9e6 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -2083,7 +2083,7 @@ static int _text_pv_add_metadata_area(const struct format_type *fmt, * alignment since it would be useless. * Check first whether we can apply that! */ - if (!pe_start_locked && + if (!pe_start_locked && alignment && ((limit - mda_start) > alignment * 2)) { mda_size = limit - mda_start - alignment * 2;