qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] Allow setting up to 8 bytes with the generic loader
@ 2022-01-20  9:27 Petr Tesarik
  2022-01-20 10:16 ` Philippe Mathieu-Daudé via
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Petr Tesarik @ 2022-01-20  9:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alistair Francis, Petr Tesarik, Alistair Francis

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: e481a1f63c93 ("generic-loader: Add a generic loader")
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 hw/core/generic-loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
index 9a24ffb880..504ed7ca72 100644
--- a/hw/core/generic-loader.c
+++ b/hw/core/generic-loader.c
@@ -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);
     }
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] Allow setting up to 8 bytes with the generic loader
  2022-01-20  9:27 [PATCH 1/1] Allow setting up to 8 bytes with the generic loader Petr Tesarik
@ 2022-01-20 10:16 ` Philippe Mathieu-Daudé via
  2022-01-21  0:01 ` Alistair Francis
  2022-01-23 23:30 ` Alistair Francis
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-01-20 10:16 UTC (permalink / raw)
  To: Petr Tesarik, qemu-devel; +Cc: Alistair Francis, Alistair Francis

On 1/20/22 10:27, Petr Tesarik wrote:
> 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: e481a1f63c93 ("generic-loader: Add a generic loader")
> Signed-off-by: Petr Tesarik <ptesarik@suse.com>
> ---
>  hw/core/generic-loader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] Allow setting up to 8 bytes with the generic loader
  2022-01-20  9:27 [PATCH 1/1] Allow setting up to 8 bytes with the generic loader Petr Tesarik
  2022-01-20 10:16 ` Philippe Mathieu-Daudé via
@ 2022-01-21  0:01 ` Alistair Francis
  2022-01-23 23:30 ` Alistair Francis
  2 siblings, 0 replies; 4+ messages in thread
From: Alistair Francis @ 2022-01-21  0:01 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Alistair Francis, qemu-devel@nongnu.org Developers,
	Alistair Francis

On Thu, Jan 20, 2022 at 7:57 PM Petr Tesarik <ptesarik@suse.com> wrote:
>
> 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: e481a1f63c93 ("generic-loader: Add a generic loader")
> Signed-off-by: Petr Tesarik <ptesarik@suse.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/core/generic-loader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
> index 9a24ffb880..504ed7ca72 100644
> --- a/hw/core/generic-loader.c
> +++ b/hw/core/generic-loader.c
> @@ -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);
>      }
> --
> 2.31.1
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] Allow setting up to 8 bytes with the generic loader
  2022-01-20  9:27 [PATCH 1/1] Allow setting up to 8 bytes with the generic loader Petr Tesarik
  2022-01-20 10:16 ` Philippe Mathieu-Daudé via
  2022-01-21  0:01 ` Alistair Francis
@ 2022-01-23 23:30 ` Alistair Francis
  2 siblings, 0 replies; 4+ messages in thread
From: Alistair Francis @ 2022-01-23 23:30 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Alistair Francis, qemu-devel@nongnu.org Developers,
	Alistair Francis

On Thu, Jan 20, 2022 at 7:57 PM Petr Tesarik <ptesarik@suse.com> wrote:
>
> 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: e481a1f63c93 ("generic-loader: Add a generic loader")
> Signed-off-by: Petr Tesarik <ptesarik@suse.com>

Thanks!

Applied to riscv-to-apply.next

Alistair

> ---
>  hw/core/generic-loader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
> index 9a24ffb880..504ed7ca72 100644
> --- a/hw/core/generic-loader.c
> +++ b/hw/core/generic-loader.c
> @@ -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);
>      }
> --
> 2.31.1
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-23 23:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-20  9:27 [PATCH 1/1] Allow setting up to 8 bytes with the generic loader Petr Tesarik
2022-01-20 10:16 ` Philippe Mathieu-Daudé via
2022-01-21  0:01 ` Alistair Francis
2022-01-23 23:30 ` Alistair Francis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).