1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

PE size overflows, on most architectures it is catch by "PE cannot be 0"

but s390x unfortunately return something usable.

Always use unit64 in inital parameter check.
This commit is contained in:
Milan Broz 2011-03-02 20:00:09 +00:00
parent 301c2b8822
commit be3510b204
4 changed files with 14 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Version 2.02.85 - Version 2.02.85 -
=================================== ===================================
Fix possible overwlow in maximum stripe size. Fix possible overflow in maximum stripe size and physical extent size.
Add test for failed allocation from dm_task_set_uuid() in dmeventd. Add test for failed allocation from dm_task_set_uuid() in dmeventd.
Improve pvremove error message when PV belongs to a VG. Improve pvremove error message when PV belongs to a VG.
Extend normal policy to allow mirror logs on same PVs as images if necessary. Extend normal policy to allow mirror logs on same PVs as images if necessary.

View File

@ -34,6 +34,7 @@
#define STRIPE_SIZE_MAX ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */ #define STRIPE_SIZE_MAX ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */
#define STRIPE_SIZE_LIMIT ((UINT_MAX >> 2) + 1) #define STRIPE_SIZE_LIMIT ((UINT_MAX >> 2) + 1)
#define MAX_RESTRICTED_LVS 255 /* Used by FMT_RESTRICTED_LVIDS */ #define MAX_RESTRICTED_LVS 255 /* Used by FMT_RESTRICTED_LVIDS */
#define MAX_EXTENT_SIZE ((uint32_t) -1)
/* Layer suffix */ /* Layer suffix */
#define MIRROR_SYNC_LAYER "_mimagetmp" #define MIRROR_SYNC_LAYER "_mimagetmp"

View File

@ -1238,6 +1238,12 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
return 1; return 1;
} }
if (arg_uint64_value(cmd, physicalextentsize_ARG, 0) > MAX_EXTENT_SIZE) {
log_error("Physical extent size cannot be larger than %s",
display_size(cmd, (uint64_t) MAX_EXTENT_SIZE));
return 1;
}
if (arg_sign_value(cmd, maxlogicalvolumes_ARG, 0) == SIGN_MINUS) { if (arg_sign_value(cmd, maxlogicalvolumes_ARG, 0) == SIGN_MINUS) {
log_error("Max Logical Volumes may not be negative"); log_error("Max Logical Volumes may not be negative");
return 1; return 1;

View File

@ -356,6 +356,12 @@ static int _vgchange_pesize(struct cmd_context *cmd, struct volume_group *vg)
{ {
uint32_t extent_size; uint32_t extent_size;
if (arg_uint64_value(cmd, physicalextentsize_ARG, 0) > MAX_EXTENT_SIZE) {
log_error("Physical extent size cannot be larger than %s",
display_size(cmd, (uint64_t) MAX_EXTENT_SIZE));
return 1;
}
extent_size = arg_uint_value(cmd, physicalextentsize_ARG, 0); extent_size = arg_uint_value(cmd, physicalextentsize_ARG, 0);
/* FIXME: remove check - redundant with vg_change_pesize */ /* FIXME: remove check - redundant with vg_change_pesize */
if (extent_size == vg->extent_size) { if (extent_size == vg->extent_size) {