summaryrefslogtreecommitdiffstats
path: root/spi.c
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2021-02-03 11:19:41 +1100
committerEdward O'Callaghan <quasisec@chromium.org>2021-05-07 02:10:48 +0000
commit4eef651ff503f81b778e5af0ed78354e0dec0dd7 (patch)
treea27e5569e594843a4cfea135d557ca4a880adf02 /spi.c
parent1a9441f7487aea5b2a03e6aa88157261c5c2ba9b (diff)
downloadflashrom-4eef651ff503f81b778e5af0ed78354e0dec0dd7.tar.gz
flashrom-4eef651ff503f81b778e5af0ed78354e0dec0dd7.tar.bz2
flashrom-4eef651ff503f81b778e5af0ed78354e0dec0dd7.zip
programmer.h: Convert anon union to anon struct
Convert the anon union of registered masters in the mst field of the flashctx to a anon struct. If we are going to dereference a pointer there in an undefined way we should crash and not plow ahead with invalid memory. The user of the registered_masters type is therefore responsible for querying the buses_supported field before attempting to dereference a ptr field in the anon struct. BUG=b:175849641 TEST=`flashrom -p internal --flash-name` Change-Id: I576967a8599b923c902e39f177f39146291cc242 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/50246 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Daniel Campello <campello@chromium.org> Reviewed-by: Sam McNally <sammc@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'spi.c')
-rw-r--r--spi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/spi.c b/spi.c
index aed2a927a..aa245d7e0 100644
--- a/spi.c
+++ b/spi.c
@@ -133,7 +133,7 @@ int spi_aai_write(struct flashctx *flash, const uint8_t *buf, unsigned int start
int register_spi_master(const struct spi_master *mst)
{
- struct registered_master rmst;
+ struct registered_master rmst = {0};
if (!mst->write_aai || !mst->write_256 || !mst->read || !mst->command ||
!mst->multicommand ||