Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/63602 )
Change subject: cpu/x86/smm: Use struct region to check overlapping sections ......................................................................
Patch Set 1:
(2 comments)
File src/cpu/x86/smm/smm_module_loader.c:
https://review.coreboot.org/c/coreboot/+/63602/comment/e84fe27e_efd252fc PS1, Line 364: static struct region_list *list; : : static int check_region(const struct region smram, : const struct region new_region, : const char *region_name) : { : if (!region_is_subregion(&smram, &new_region)) { : printk(BIOS_ERR, "%s not in SMM\n", region_name); : return 1; : } : : struct region_list *test; : for (test = list; test != NULL; test = test->next) { : if (region_overlap(&test->region, &new_region)) { : printk(BIOS_ERR, "%s overlaps with a previous region\n", region_name); : return 1; : } : } : /* All is fine. Add the new region to the linked list */ : struct region_list *new_entry = malloc(sizeof(struct region_list)); : if (new_entry == NULL) { : printk(BIOS_ERR, "Out of memory\n"); : return 1; : } : : test->next = new_entry; : new_entry->region = new_region; : new_entry->next = NULL; : printk(BIOS_DEBUG, "%-12s [0x%lx-0x%lx]\n", region_name, region_offset(&new_region), : region_end(&new_region)); : return 0;
really messing up linked lists here...
Done
https://review.coreboot.org/c/coreboot/+/63602/comment/130bf3cc_45f2cac1 PS1, Line 399: struct region_list *entry = list; : struct region_list *next_entry; : while (1) { : if (entry == NULL) : return; : next_entry = entry->next; : free(entry); : entry = next_entry; : }
won't work. Only the last allocated element is freed.
Done