summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2020-03-31 15:32:10 +0200
committerAngel Pons <th3fanbus@gmail.com>2020-04-25 15:16:17 +0000
commit2ee489d7ef5b653c50522a8dad699eee622078ab (patch)
treeb2bbfc91c0dbd6344de271121dcff7efd9d66067
parent94991d83e47453367819491fa7f3c9ff4ff0d68d (diff)
downloadflashrom-2ee489d7ef5b653c50522a8dad699eee622078ab.tar.gz
flashrom-2ee489d7ef5b653c50522a8dad699eee622078ab.tar.bz2
flashrom-2ee489d7ef5b653c50522a8dad699eee622078ab.zip
spi25.c: Add a null check
Change-Id: I5fcc23d81b8404af90768afa2954509bf334ab2c Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/39974 Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--spi25.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/spi25.c b/spi25.c
index c774f9917..16d7f1b1d 100644
--- a/spi25.c
+++ b/spi25.c
@@ -570,6 +570,8 @@ static int spi_write_cmd(struct flashctx *const flash, const uint8_t op,
msg_cerr("%s called for too long a write\n", __func__);
return 1;
}
+ if (!out_bytes && out_len > 0)
+ return 1;
memcpy(cmd + 1 + addr_len, out_bytes, out_len);
cmds[1].writecnt = 1 + addr_len + out_len;