mirror of
https://review.coreboot.org/flashrom.git
synced 2025-06-30 21:52:36 +02:00
Use a distinct return code for SPI commands with unsupported/invalid length
Some drivers support only a few combinations of read/write length and return error otherwise. Having a distinct return code for this error means we can handle it in upper layers. Corresponding to flashrom svn r653. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Stefan Reinauer <stepan@coresystems.de>
This commit is contained in:
@ -201,6 +201,9 @@ int ft2232_spi_send_command(unsigned int writecnt, unsigned int readcnt,
|
||||
unsigned char port_val = 0;
|
||||
int i, ret = 0;
|
||||
|
||||
if (writecnt > 65536 || readcnt > 65536)
|
||||
return SPI_INVALID_LENGTH;
|
||||
|
||||
buf = realloc(buf, writecnt + readcnt + 100);
|
||||
if (!buf) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
|
Reference in New Issue
Block a user