Skip to content

Commit beced13

Browse files
bjohnstoMikulas Patocka
authored andcommitted
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>
1 parent 2fb98e4 commit beced13

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/md/dm-vdo/dm-vdo-target.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,12 @@ static int parse_device_config(int argc, char **argv, struct dm_target *ti,
792792
struct device_config *config = NULL;
793793
int result;
794794

795+
if (logical_bytes > (MAXIMUM_VDO_LOGICAL_BLOCKS * VDO_BLOCK_SIZE)) {
796+
handle_parse_error(config, error_ptr,
797+
"Logical size exceeds the maximum");
798+
return VDO_BAD_CONFIGURATION;
799+
}
800+
795801
if ((logical_bytes % VDO_BLOCK_SIZE) != 0) {
796802
handle_parse_error(config, error_ptr,
797803
"Logical size must be a multiple of 4096");

0 commit comments

Comments
 (0)