That's gonna be a nice feature. Thanks for doing it.
5 comments:
This should be -1!
Maybe add "flashrom" here? or at least an "it" would make the sentence correct.
Patch Set #20, Line 59: flash
What you actually check here is not the overall flashsize itself but the size of this FMAP instance in the flash. If you want you can be more precise in the comment but it's up to you.
if (!flashctx || !flashctx->chip)
return 1;
Would you like to add this check to fmap_lsearch_rom() as well?
struct fmap *tmp = fmap;
fmap = realloc(fmap, fmap_len);
if (!fmap) {
msg_gerr("Failed to realloc.\n");
free(tmp);
goto _free_ret;
}
realloc is allowed to move the re-allocated memory buffer to a completely new address[1]. If that happens you will end up not freeing allocated memory.
You can check if after realloc() fmap and tmp do not match and free tmp in this case. Or do I miss something here?
[1] https://stackoverflow.com/questions/35413891/does-realloc-change-pointer-address
To view, visit change 23203. To unsubscribe, or for help writing mail filters, visit settings.