Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/39687 )
Change subject: lspcon_i2c_spi.c: Add SPI-master support for PS17{5,6} ......................................................................
Patch Set 7:
(3 comments)
https://review.coreboot.org/c/flashrom/+/39687/4/lspcon_i2c_spi.c File lspcon_i2c_spi.c:
https://review.coreboot.org/c/flashrom/+/39687/4/lspcon_i2c_spi.c@364 PS4, Line 364: uint8_t write_buffer[len + 1];
We can use a fixed size buffer with buf[256 + 1] since that'd be the max size. […]
You could have a static buffer of len 257 /* extra byte needed for prefixing zero in idx 0 */ and a if check to validate len does not exceed the static buffer before the memcpy()
https://review.coreboot.org/c/flashrom/+/39687/4/lspcon_i2c_spi.c@365 PS4, Line 365: write_buffer[0] = 0
Do you have any idea if we have to change this or resolve the comment?
by initialising the static buf to zero you can skip this.
https://review.coreboot.org/c/flashrom/+/39687/4/lspcon_i2c_spi.c@366 PS4, Line 366: write_buffer + 1 just say &write_buf[1] here, kind of makes it more clear.