Skip to content

Commit

Permalink
Allow setting up to 8 bytes with the generic loader
Browse files Browse the repository at this point in the history
The documentation for the generic loader says that "the maximum size of
the data is 8 bytes". However, attempts to set data-len=8 trigger the
following assertion failure:

../hw/core/generic-loader.c:59: generic_loader_reset: Assertion `s->data_len < sizeof(s->data)' failed.

The type of s->data is uint64_t (i.e. 8 bytes long), so I believe this
assert should use <= instead of <.

Fixes: e481a1f ("generic-loader: Add a generic loader")
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220120092715.7805-1-ptesarik@suse.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
Petr Tesarik authored and alistair23 committed Feb 10, 2022
1 parent 0da53b4 commit 31b35b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hw/core/generic-loader.c
Expand Up @@ -56,7 +56,7 @@ static void generic_loader_reset(void *opaque)
}

if (s->data_len) {
assert(s->data_len < sizeof(s->data));
assert(s->data_len <= sizeof(s->data));
dma_memory_write(s->cpu->as, s->addr, &s->data, s->data_len,
MEMTXATTRS_UNSPECIFIED);
}
Expand Down

0 comments on commit 31b35b4

Please sign in to comment.