Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/68160 )
Change subject: util/cbfstool: Add a new mechanism to provide a memory mapped ......................................................................
Patch Set 1:
(1 comment)
File util/cbfstool/cbfstool.c:
https://review.coreboot.org/c/coreboot/+/68160/comment/67d2bcec_1aec5d1e PS1, Line 335: static int decode_mmap_arg(char *optarg) : { : if (optarg == NULL) : return 1; : : unsigned long flash_base; : unsigned long mmap_base; : unsigned long region_size; : char *suffix = NULL; : char *substring = strtok(optarg, ":"); : if (substring) : flash_base = strtol(substring, &suffix, 0); : if (!substring || (suffix && *suffix)) { : ERROR("Invalid flash base address '%s'.\n", : optarg); : return 1; : } : substring = strtok(NULL, ":"); : if (substring) : mmap_base = strtol(substring, &suffix, 0); : if (!substring || (suffix && *suffix)) { : ERROR("Invalid mmap base address '%s'.\n", : optarg); : return 1; : } : substring = strtok(NULL, ":"); : if (substring) : region_size = strtol(substring, &suffix, 0); : if (!substring || (suffix && *suffix)) { : ERROR("Invalid flash region size '%s'.\n", : optarg); : return 1; : } : : if (strtok(NULL, ":") != NULL) { : ERROR("Invalid argument, too many substrings '%s'.\n", : optarg); : : return 1; : } : : add_mmap_window(flash_base, mmap_base, region_size); : return 0; This looks bad. Any suggestions? I'm really not used to writing userspace programs ^^