Richard Spiegel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31473 )
Change subject: drivers/spi/spi_flash.c: Avoid static scan false positive ......................................................................
Patch Set 1:
(3 comments)
Though I'm sure my way would solve the issue, I liked the idea of presetting ret to -1 and will follow it.
https://review.coreboot.org/#/c/31473/1/src/drivers/spi/spi_flash.c File src/drivers/spi/spi_flash.c:
https://review.coreboot.org/#/c/31473/1/src/drivers/spi/spi_flash.c@199 PS1, Line 199: ;
If this is set to -1 here, wouldn't it make the static checker happy?
Probably
https://review.coreboot.org/#/c/31473/1/src/drivers/spi/spi_flash.c@207 PS1, Line 207: <
len is of type size_t. […]
I know, you know, but somehow static scan does not.
https://review.coreboot.org/#/c/31473/1/src/drivers/spi/spi_flash.c@214 PS1, Line 214: offset
Isn't offset the same as start? I don't understand the change here?
Because comparison is between end and offset and len now has to be positive, I explicitly tell the static check that end must start bigger then offset. I agree I could use start as originally, but this way I make it explicit.