From 99f04835802ee675242a4896697eb784717ee998 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 29 May 2013 14:50:21 +0200 Subject: [PATCH] args: do not accept >=16EiB sizes Instead of seeing wierd overflows inside the lvm code, giving false error messages, kill the user experiment in the begining. Who needs to use more then 16EiB with lvm2 and 64bit anyway... --- WHATS_NEW | 1 + tools/lvmcmdline.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index f5adc0bfc..86357fd1f 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.99 - =================================== + Do not accept size parameters bigger then 16EiB. Fix release of PV's fid in free_pv_fid(). Skip monitoring of snapshots that are already bigger then origin. Add lv_is_cow_covering_origin() to check if cow covers origin size. diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 0b64ed839..89ead2c74 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -340,6 +340,10 @@ static int _size_arg(struct cmd_context *cmd __attribute__((unused)), struct arg } else v *= factor; + if ((uint64_t) v >= (UINT64_MAX >> SECTOR_SHIFT)) { + log_error("Size is too big (>=16EiB)."); + return 0; + } av->i_value = (int32_t) v; av->ui_value = (uint32_t) v; av->i64_value = (int64_t) v;