mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 16:01:44 -04:00
dm vdo: add upfront validation for logical size
Add a validation check that the logical size passed via the table line does not exceed MAXIMUM_VDO_LOGICAL_BLOCKS. Signed-off-by: Bruce Johnston <bjohnsto@redhat.com> Reviewed-by: Matthew Sakai <msakai@redhat.com> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
This commit is contained in:
committed by
Mikulas Patocka
parent
2fb98e4170
commit
beced130a3
@@ -792,6 +792,12 @@ static int parse_device_config(int argc, char **argv, struct dm_target *ti,
|
||||
struct device_config *config = NULL;
|
||||
int result;
|
||||
|
||||
if (logical_bytes > (MAXIMUM_VDO_LOGICAL_BLOCKS * VDO_BLOCK_SIZE)) {
|
||||
handle_parse_error(config, error_ptr,
|
||||
"Logical size exceeds the maximum");
|
||||
return VDO_BAD_CONFIGURATION;
|
||||
}
|
||||
|
||||
if ((logical_bytes % VDO_BLOCK_SIZE) != 0) {
|
||||
handle_parse_error(config, error_ptr,
|
||||
"Logical size must be a multiple of 4096");
|
||||
|
||||
Reference in New Issue
Block a user