Attention is currently required from: Light, Anastasia Klimchuk. Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/62747 )
Change subject: flashrom.c, sfdp.c: Initialize dynamically allocated memory using calloc ......................................................................
Patch Set 9:
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/62747/comment/6cc8def6_06dc6174 PS9, Line 11: when later used in need_erase could result in undefined behaviour. Can that happen generally, or only when there is another bug? If it would need another bug, initializing the memory to 0 could make it harder to detect that.
For instance, if uninitialized data from `curcontents` could end up on a flash chip. That happening could be much more obvious with random values compared to constant 0. If we want to prepare for such bugs, we can choose something better than 0, for instance a repeated pattern like "flashrom bug! ".
For `oldcontents` I'm not so sure. As it's used to compare to read data during verification, technically initializing it with pseudo- random values would be best to detect errors. But some static pat- tern should serve as well.