diff options
author | hailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2009-07-14 10:26:56 +0000 |
---|---|---|
committer | hailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2009-07-14 10:26:56 +0000 |
commit | edee3683b1b451089c6f160bb3540e65354a0e24 (patch) | |
tree | c286d89dadacecee2e68b84ce5606467e9ae33e8 /ft2232_spi.c | |
parent | 3f6c540ae63303e5eb63383230c90076f7956113 (diff) | |
download | flashrom-edee3683b1b451089c6f160bb3540e65354a0e24.tar.gz |
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.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@653 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'ft2232_spi.c')
-rw-r--r-- | ft2232_spi.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ft2232_spi.c b/ft2232_spi.c index 8e6e836..5d229b3 100644 --- a/ft2232_spi.c +++ b/ft2232_spi.c @@ -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"); |